From 24f4faed9be9f1a2a6c5fd9d41bec502960a93b6 Mon Sep 17 00:00:00 2001 From: Thomas KLEIN Date: Sat, 25 Jan 2025 20:11:09 +0100 Subject: [PATCH] try try --- next.config.ts | 26 ++++---------------------- src/types/custom.d.ts | 5 ----- svgr.d.ts | 5 ----- 3 files changed, 4 insertions(+), 32 deletions(-) delete mode 100644 src/types/custom.d.ts diff --git a/next.config.ts b/next.config.ts index aa9e87f..84658a8 100644 --- a/next.config.ts +++ b/next.config.ts @@ -3,28 +3,10 @@ import type { NextConfig } from "next"; const nextConfig: NextConfig = { reactStrictMode: true, webpack(config) { - // Grab the existing rule that handles SVG imports - const fileLoaderRule = config.module.rules.find((rule) => - rule.test?.test?.('.svg'), - ); - - config.module.rules.push( - // Reapply the existing rule, but only for svg imports ending in ?url - { - ...fileLoaderRule, - test: /\.svg$/i, - resourceQuery: /url/, // *.svg?url - }, - // Convert all other *.svg imports to React components - { - test: /\.svg$/i, - issuer: fileLoaderRule.issuer, - resourceQuery: {not: [...fileLoaderRule.resourceQuery.not, /url/]}, // exclude if *.svg?url - use: ['@svgr/webpack'], - } - ); - // Modify the file loader rule to ignore *.svg, since we have it handled now. - fileLoaderRule.exclude = /\.svg$/i; + config.module.rules.push({ + test: /\.svg$/i, + use: ['@svgr/webpack'], + }); return config; } diff --git a/src/types/custom.d.ts b/src/types/custom.d.ts deleted file mode 100644 index b703d05..0000000 --- a/src/types/custom.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -declare module "*.svg" { - import {FC, SVGProps} from "react"; - const content: FC>; - export default content; -} diff --git a/svgr.d.ts b/svgr.d.ts index ccca311..c2ad6a7 100644 --- a/svgr.d.ts +++ b/svgr.d.ts @@ -3,8 +3,3 @@ declare module '*.svg' { const content: FC>; export default content; } - -declare module '*.svg?url' { - const content: any; - export default content; -}