JetBrains / svg-sprite-loader

Webpack loader for creating SVG sprites.
MIT License
2.01k stars 271 forks source link

Extract mode fails with pitching loaders #471

Open sidletski opened 3 years ago

sidletski commented 3 years ago

Do you want to request a feature, report a bug or ask a question? A bug/question

What is the current behavior? Looks like svg-sprite-loader using with sprite loader plugin in extract mode doesn't work with pitching loaders

If the current behavior is a bug, please provide the steps to reproduce, at least part of webpack config with loader configuration and piece of your code. Create custom webpack loader with pitching logic. For example, I want to use require('picture.svg') to require picture-dark.svg and picture-light.svg and generate sprite by svg-sprite-loader. Custom loader very basic example: here

It works fine when I try to return module.exports = require(${JSON.stringify(darkPictureRequest)}), but when I'm going to pass more than one file to the svg-sprite-loader with extract option enabled, my next.js page is in state of constant loading. If I understand correctly, there is a similar problem when using extract-text-webpack-plugin, because its loader also uses pitching, so its hooks are called inside the svg sprite plugin.

How can you advise me to change the loader so that everything works correctly?

Please tell us about your environment: