svg-sprite-loader
svg-sprite-loader copied to clipboard
Webpack 5! Is svg-sprite-loader compatible with Webpack 5?
Webpack 5! Is svg-sprite-loader compatible with Webpack 5?
I update my application from 4 to 5 webpack and seems sprite stop working properly.
svg-sprite-loader is not generated symbol anymore, instead I got this data data:image/svg+xml;base64
Current behavior
I receive this as output:
Expected behavior
With webpack 4 I have this:
This is a part of my webpack config
environment:
- Node.js version: 12.17.0
- React version: 17.0.2
- webpack version: 5.66.0
- svg-sprite-loader version: 6.0.11
- OS type & version: Ubuntu
I tried many cases and config changes...but with no success. I don't know even to what I should pay attention, because there are no visible errors while building the app. also there is no info in readme regarding webpack5.
I would really appreciate any help. Thanks.
Here #470 I posted diff that also adds webpack@5 support.
Hi @chrisands. Thanks. I will check it out.
Set Rule.type
to javascript/auto
works for me.
Set
Rule.type
tojavascript/auto
works for me.
seems work for me too
Set
Rule.type
tojavascript/auto
works for me.
This needs to be added to the documentation. I searched for this solution almost an entire day. Is it a webpack or a loader specific config? In my case, i was doing a require.context
for the svgs and importing them all from a folder. Before i upgraded webpack, i was getting actual modules but after the upgrade i was just getting strings
const requireContext = require.context('./assets/svg', true, /\.svg$/)
requireContext.keys().forEach(requireContext)