@kkurko/storybook-react-svgr
Version:
Storybook SVGR plugin for react to allow imports of .svg files
37 lines • 871 B
JavaScript
module.exports = {
webpackFinal(config = {}, options = {}) {
return {
...config,
module: {
...config.module,
rules: [
...config.module.rules.map((_) => {
if (_.test.toString().includes('svg|')) {
return {
..._,
test: new RegExp(_.test.source.replace('svg|', '')),
};
}
return _;
}),
{
test: /(icons|images)\/.*?.svg$/,
use: [
{
loader: '@svgr/webpack',
options: {
svgoConfig: {
plugins: {
removeViewBox: false,
},
},
},
},
'file-loader',
],
},
],
},
};
},
}