Closed kush1960 closed 3 years ago
Looking into this further, it appears that SpritePlugin.loader is generating the sprite sheet twice. If I remove one of the entry points below:
entry: {
frontend: ['./src/sass/style.scss', './src/index.js'],
}
It works without errors.
Ignore me, I just noticed I had this in my index.js file require.context('./svg', true, /\.svg$/);
Hi after much trial and error I've managed to get
extract-svg-sprite-webpack-plugin
to successfully build a spritesheet from a folder of SVGs and transpile my SCSS path to the correct symbol reference.However I get this annoying warning every-time the build task runs:
WARNING in ./src/svg/filter.svg Module Warning (from ./node_modules/extract-svg-sprite-webpack-plugin/lib/loader.js): Symbol with id "filter" already exists. It happens when you require SVGs with the same file name from different folders. Set "symbolId" option to more specific, e.g. "[path]-[name]-[hash]" @ ./src/sass/style.scss (./node_modules/css-loader/dist/cjs.js!./node_modules/extract-svg-sprite-webpack-plugin/lib/css-loader.js!./node_modules/sass-loader/dist/cjs.js!./src/sass/style.scss) 7:36-64
In my use case, this warning doesn't make sense since there is only one reference to the SVG, but I wonder if I have my config wrong and it's somehow running twice?
FYI I'm using Webpack with Wordpress, so I'm only interested in building a sprite sheet from a folder of icons and fixing my CSS references to the icon id... As I said, that's all working. It's just I get this annoying error!
Here's my webpack.config.js:
If anyone can help me, I'll gladly send buy you a coffee/beer!
Thank you, I'm at the end of my knowledge with this :(