Can't set SVGO options
See original GitHub issue🐛 Bug Report
I need basically need to keep the svg viewBox when using @svgr/webpack.
I tried every piece of documentation I found spread among web pages and tickets previously opened in git.
svgr/webpack version: 5.1.0 webpack version: 4.29.6
To Reproduce
Configurations I tried:
webpack config file:
{
test: /\.svg$/,
use: [{
loader: '@svgr/webpack',
options: {
svgoConfig: {
plugins: [{
removeViewBox: false
}]
}
}
}, 'file-loader']
},
in .svgorc:
plugins:
- removeViewBox: false
with the webpack config file I tried inside my application:
import svgfileurl , { ReactComponent as svgFile } from 'whatevever.svg'
both svgfileurl and svgFile return a function which returns a reactComponent
Expected behavior
For the viewBox attribute to be preserved
Any ideas?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:13 (5 by maintainers)
Top Results From Across the Web
Unable to configure svgo-loader (webpack) - Stack Overflow
There is no need to pass any options for the svgo-loader in the webpack config. Just passing the default config under the root...
Read more >Options - SVGR
SVGR ships with a handful of customizable options, usable in both the CLI and API. ... Disable runtime config ( .svgrrc , .svgo.yml...
Read more >SVG Export | Figma Community
Save time exporting sets of SVGs by creating and assigning presets to optimize your exports. Works great for making icon libraries use clean...
Read more >ImageMinimizerWebpackPlugin | webpack
imagemin-svgo can be configured in lossless and lossy mode. Explore the options to get the best result for you. Recommended imagemin plugins for...
Read more >client/node_modules/svgo/CHANGELOG.md · homepage_full
Fixed TypeError: Cannot set property 'multipassCount' of undefined ... prefixIds plugin now runs only once with --multipass option (by ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@VityaSchel you should give a look to SVGO documentation.
Hey guys, I just went through the same issue on v5.2.0 . After trying a lot of things, nothing worked.
So I downgraded to 4.3.3 , using the config below and it’s working for me now.