Skip to content

Commit b67e116

Browse files
refactor: onfigure SVG loader
1 parent e5474cf commit b67e116

2 files changed

Lines changed: 38 additions & 2 deletions

File tree

config/webpack.config.js

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,43 @@ module.exports = function (webpackEnv) {
375375
},
376376
{
377377
test: /\.svg$/,
378-
use: ['@svgr/webpack'],
378+
use: [
379+
{
380+
loader: require.resolve('@svgr/webpack'),
381+
options: {
382+
prettier: false,
383+
svgo: false,
384+
svgoConfig: {
385+
plugins: [{ removeViewBox: false }],
386+
},
387+
titleProp: true,
388+
ref: true,
389+
},
390+
},
391+
{
392+
loader: 'svgo-loader',
393+
options: {
394+
plugins: [
395+
'removeTitle',
396+
'removeStyleElement',
397+
'cleanupIDs',
398+
'inlineStyles',
399+
'removeXMLProcInst',
400+
{
401+
name: 'removeAttrs',
402+
params: {
403+
attrs: [
404+
'fill',
405+
'fill-rule',
406+
'clip-rule',
407+
'stroke',
408+
],
409+
}
410+
}
411+
]
412+
}
413+
}
414+
],
379415
},
380416
{
381417
test: /\.worker\.js$/,

src/DTableIcon/svg-icon.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const getSvgIconComponents = () => {
2424
const SvgIcon = ({ className, symbol, color, ariaHidden, getSvg }) => {
2525
if (!symbol) return null;
2626

27-
let props = { style: { fill: color } };
27+
let props = { style: { color: color } };
2828
if (ariaHidden) {
2929
props['aria-hidden'] = ariaHidden;
3030
}

0 commit comments

Comments
 (0)