Here is my rule:
const inlineSvgRule = {
test: /\.inline.svg$/,
use: [
{
loader: require.resolve('@svgr/webpack'),
options: {
svgoConfig: {
removeViewBox: false,
cleanupIDs: {
prefix: {
toString() {
this.counter = this.counter || 0;
return `id-${this.counter++}`;
},
},
},
},
},
},
],
issuer: {
test: /\.(js|jsx|ts|tsx)$/,
},
};
Passing options literally does nothing
npx envinfo --system --binaries --npmPackages @svgr/core,@svgr/cli,@svgr/webpack,@svgr/rollup --markdown --clipboardPaste the results here:
## System:
- OS: macOS 10.14.5
- CPU: (4) x64 Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz
- Memory: 73.98 MB / 8.00 GB
- Shell: 5.3 - /bin/zsh
## Binaries:
- Node: 12.10.0 - /usr/local/bin/node
- Yarn: 1.17.3 - /usr/local/bin/yarn
- npm: 6.11.3 - /usr/local/bin/npm
## npmPackages:
- @svgr/webpack: ^4.3.3 => 4.3.3
You should use svgo instead svgoConfig.
svgo is boolean and svgoConfig is object
Oh sorry you are right. So it is actually a bug.
@SilencerWeb I've found a way to fix it.
You should pass svgoConfig as below:
options: {
svgoConfig: {
plugins: [{
removeViewBox: false,
}]
}
}
Most helpful comment
@SilencerWeb I've found a way to fix it.
You should pass svgoConfig as below: