From 1ed871a9fd0cee1b4326f5930c3a49c8c6ad602f Mon Sep 17 00:00:00 2001 From: Ilia Mashkov Date: Thu, 20 Nov 2025 12:04:08 +0300 Subject: [PATCH] =?UTF-8?q?feat:=20=D0=A3=D0=BB=D1=83=D1=87=D1=88=D0=B5?= =?UTF-8?q?=D0=BD=D0=B0=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=B0=20=D1=81=20?= =?UTF-8?q?svg,=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=B0?= =?UTF-8?q?=20=D0=BF=D0=BE=D0=B4=D0=B4=D0=B5=D1=80=D0=B6=D0=BA=D0=B0=20?= =?UTF-8?q?=D0=BA=D0=B0=D1=81=D1=82=D0=BE=D0=BC=D0=B8=D0=B7=D0=B0=D1=86?= =?UTF-8?q?=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/build/loaders/buildSvgrLoader.ts | 27 ++++++++++++++++++++++++- src/app/types/declarations.d.ts | 6 +++++- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/config/build/loaders/buildSvgrLoader.ts b/config/build/loaders/buildSvgrLoader.ts index 71b9ad9..22a6369 100644 --- a/config/build/loaders/buildSvgrLoader.ts +++ b/config/build/loaders/buildSvgrLoader.ts @@ -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 diff --git a/src/app/types/declarations.d.ts b/src/app/types/declarations.d.ts index 144c247..79c4950 100644 --- a/src/app/types/declarations.d.ts +++ b/src/app/types/declarations.d.ts @@ -11,4 +11,8 @@ declare module '*.scss' { declare module '*.png' declare module '*.jpg' declare module '*.jpeg' -declare module '*.svg' +declare module '*.svg' { + import React from 'react' + const SVGComponent: React.FC> + export default SVGComponent +}