Output of assets during server build
lutzk opened this issue · comments
https://github.com/halt-hammerzeit/universal-webpack/blob/master/README.md#drawbacks
If you find a way to avoid that, drop me a line
I found the output of images / fonts for server build can be disabled with:
emitFile: false
in url-loader
and file-loader
options
test: /\.(jpg|png|gif|svg|ico)$/,
use: [
{
loader: 'url-loader',
options: {
emitFile: false,
limit: embedLimit
}
}
]
#45
Removing style-loader
and just use css-loader/locals
works for me to prevent the output of a css file for server render
( i dont use css modules )
{
test: /\.css$/,
use: [{ loader: 'css-loader/locals' }]
},
{
test: /\.(scss|sass)$/,
use: [
{
loader: 'css-loader/locals',
options: {
importLoaders: 1
}
},
{
loader: 'sass-loader',
options: {
...
}
}
]
}
I can send a pull request to add these info to the readme if wanted
Thx for sharing your thoughts.
I finally have some time to implement them as part of a new release.
I investigated a bit and seems that the asset filenames are the same for client-side build and server-side build, therefore the server-side assets theoretically could be omitted using emit: false
flag and it might work, I'll check that tomorrow.
About the css-loader/locals
, I guess that's gonna work too, and I'll see if it can replace fake-style-loader
tomorrow.
I released version 0.3.x
removing fake-style-loader
in favour of css-loader/locals
.
Try it.
It now also doesn't emit any assets on the server side.