feat: Улучшена работа с svg, добавлена поддержка кастомизации
This commit is contained in:
@@ -17,7 +17,32 @@
|
||||
export function buildSvgrLoader() {
|
||||
const svgrLoader = {
|
||||
test: /\.svg$/,
|
||||
use: ['@svgr/webpack'],
|
||||
use: [
|
||||
{
|
||||
loader: '@svgr/webpack',
|
||||
options: {
|
||||
// Replace currentColor with props
|
||||
replaceAttrValues: {
|
||||
currentColor: '{props.stroke || "currentColor"}',
|
||||
},
|
||||
// Allow width and height to be customizable
|
||||
dimensions: false,
|
||||
svgoConfig: {
|
||||
plugins: [
|
||||
{
|
||||
name: 'preset-default',
|
||||
params: {
|
||||
overrides: {
|
||||
// Keep viewBox for proper scaling
|
||||
removeViewBox: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
return svgrLoader
|
||||
|
||||
Reference in New Issue
Block a user