From dba82b7d370b7adc0d2cd56a4619939567a827ab Mon Sep 17 00:00:00 2001 From: mateuszmiko <dmastah92@gmail.com> Date: Tue, 26 Sep 2023 10:34:11 +0200 Subject: [PATCH] Bug/display svg url --- @types/images.d.ts | 4 ++-- next.config.js | 4 ++-- src/shared/Icon/Icon.component.tsx | 14 +++++++------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/@types/images.d.ts b/@types/images.d.ts index 8d735bfb..90226175 100644 --- a/@types/images.d.ts +++ b/@types/images.d.ts @@ -10,12 +10,12 @@ declare module '*.png' { export default content; } -declare module '*.svg' { +declare module '*.svg?component' { const content: React.FC<React.SVGProps<SVGSVGElement>>; export default content; } -declare module '*.svg?url' { +declare module '*.svg' { const content: any; export default content; } diff --git a/next.config.js b/next.config.js index 44b570e1..966d1c5c 100644 --- a/next.config.js +++ b/next.config.js @@ -7,12 +7,12 @@ const nextConfig = { { ...fileLoaderRule, test: /\.svg$/i, - resourceQuery: /url/, + resourceQuery: { not: /component/ }, }, { test: /\.svg$/i, issuer: /\.[jt]sx?$/, - resourceQuery: { not: /url/ }, + resourceQuery: /component/, use: ['@svgr/webpack'], }, ); diff --git a/src/shared/Icon/Icon.component.tsx b/src/shared/Icon/Icon.component.tsx index 0ba0aed9..7f2462eb 100644 --- a/src/shared/Icon/Icon.component.tsx +++ b/src/shared/Icon/Icon.component.tsx @@ -1,10 +1,10 @@ -import ChevronRightIcon from '@/assets/vectors/icons/chevron-right.svg'; -import ChevronLeftIcon from '@/assets/vectors/icons/chevron-left.svg'; -import ChevronUpIcon from '@/assets/vectors/icons/chevron-up.svg'; -import ChevronDownIcon from '@/assets/vectors/icons/chevron-down.svg'; -import PlusIcon from '@/assets/vectors/icons/plus.svg'; -import ArrowIcon from '@/assets/vectors/icons/arrow.svg'; -import DotsIcon from '@/assets/vectors/icons/dots.svg'; +import ChevronRightIcon from '@/assets/vectors/icons/chevron-right.svg?component'; +import ChevronLeftIcon from '@/assets/vectors/icons/chevron-left.svg?component'; +import ChevronUpIcon from '@/assets/vectors/icons/chevron-up.svg?component'; +import ChevronDownIcon from '@/assets/vectors/icons/chevron-down.svg?component'; +import PlusIcon from '@/assets/vectors/icons/plus.svg?component'; +import ArrowIcon from '@/assets/vectors/icons/arrow.svg?component'; +import DotsIcon from '@/assets/vectors/icons/dots.svg?component'; type Name = | 'chevron-right' -- GitLab