Open zecka opened 3 years ago
Same issue here after updating to Webpack 5. Looks like critical, can't update our project to webpack 5 because of this...
The same here, still no luck on finding a solution.
Same here :(
Same here 😢
same here :(
same here :(
Not the same issue, I missread, but very worth knowing for other fellow googlers if they stumble on the same issue as me updating from webpack4 to webpack5, you cannout use 'style-loader' as it causes the css file to point to a '[non-existant-hash].svg'
instead of 'icons.svg'
which was configured like below
{
test : /\.svg$/,
include : path.resolve( './assets/icons' ),
use : [
{
loader : 'svg-sprite-loader',
options : {
extract : true,
spriteFilename : 'images/icons.svg',
esModule : false
}
},
'svgo-loader'
]
},
{
test : /\.scss|\.css$/,
use : [
{
loader : MiniCssExtractPlugin.loader, // <- fixes it
options : {
publicPath : '../'
}
// loader: 'style-loader', // <- caused the '[hash].svg' instead of 'icons.svg'
},
{
loader : 'css-loader'
},
{
loader : 'postcss-loader'
},
{
loader : 'sass-loader'
}
]
},
Still having this issue. Has anybody got any workaround?
Current output
Expected output
Github repo issue
Here is a repo to reproduce this issue: https://github.com/zeckaissue/svg-sprite-loader-issue
My webpack config