react-svg-loader
react-svg-loader copied to clipboard
Can't turn off removeViewBox
This config still removes the viewBox attribute from SVGs loaded with react-svg-loader. Why is that?
options: {
svgo: {
plugins: [
{
convertPathData: { noSpaceAfterFlags: false },
removeViewBox: false,
},
],
},
},
@kvillaniholland curious did you ever find a fix? 🙏
No - what I ended up doing was changing the viewBox on the particular SVG that was breaking from 0 0 24 24 to 1 0 24 24 - the change was almost imperceptible, but the 1 stopped removeViewBox from removing the property.
Ah I see, thanks - I actually ended up just using svgr/webpack instead
if anyone else comes across this, it was my fault; the config should have been:
options: {
svgo: {
plugins: [
{ convertPathData: { noSpaceAfterFlags: false } },
{ removeViewBox: false },
],
},
},
@kvillaniholland solution worked for me 🙌🏻