From 55a9631d3aca95c6685dd49a8b712be60ab64140 Mon Sep 17 00:00:00 2001 From: Thomas KLEIN Date: Sat, 25 Jan 2025 19:52:27 +0100 Subject: [PATCH] add SVGR module --- next.config.ts | 2 +- src/components/Hero/Hero.tsx | 2 +- src/layouts/Footer/Footer.tsx | 8 ++++---- svgr.d.ts | 5 +++++ tsconfig.json | 8 +++++++- 5 files changed, 18 insertions(+), 7 deletions(-) create mode 100644 svgr.d.ts diff --git a/next.config.ts b/next.config.ts index 87f41bf..8ce01f2 100644 --- a/next.config.ts +++ b/next.config.ts @@ -4,7 +4,7 @@ const nextConfig: NextConfig = { reactStrictMode: true, webpack(config) { config.module.rules.push({ - test: /\.svg$/, + test: /\.svg$/i, use: ['@svgr/webpack'] }); return config; diff --git a/src/components/Hero/Hero.tsx b/src/components/Hero/Hero.tsx index 0f0f53b..b272032 100644 --- a/src/components/Hero/Hero.tsx +++ b/src/components/Hero/Hero.tsx @@ -3,7 +3,7 @@ import Typography from "@/components/Typography/Typography"; import BackgroundImage from "@/components/BackgroundImage/BackgroundImage"; import CountdownTimer from "@/components/Countdown/Countdown" import Container from "@/layouts/Container"; -import MMFRFull from "./mmfr25-full.svg"; +import MMFRFull from "/public/images/mmfr25-full.svg"; const Hero = () => { return ( diff --git a/src/layouts/Footer/Footer.tsx b/src/layouts/Footer/Footer.tsx index f660be8..58886fd 100644 --- a/src/layouts/Footer/Footer.tsx +++ b/src/layouts/Footer/Footer.tsx @@ -3,10 +3,10 @@ import About from "@/components/About/About"; import Typography from "@/components/Typography/Typography"; import {List as FooterMenu} from "@/components/List/List"; import Container from "@/layouts/Container"; -import FooterLogo from "./logo_macaron.svg"; -import HashtagMMFR from "./mmfr2025-footer.svg"; -import FooterPatternLeft from "./footer_pattern_left.svg"; -import FooterPatternRight from "./footer_pattern_right.svg"; +import FooterLogo from "/public/images/logo_macaron.svg"; +import HashtagMMFR from "/public/images/mmfr2025-footer.svg"; +import FooterPatternLeft from "/public/images/footer_pattern_left.svg"; +import FooterPatternRight from "/public/images/footer_pattern_right.svg"; import {Content, ListItem} from "@/components/List/List.types"; import {FaLinkedinIn, FaYoutube} from "react-icons/fa"; import Link from "next/link"; diff --git a/svgr.d.ts b/svgr.d.ts new file mode 100644 index 0000000..c8768ec --- /dev/null +++ b/svgr.d.ts @@ -0,0 +1,5 @@ +declare module '*.svg' { + import { FC, SVGProps } from "react"; + const content: FC>; + export default content; +} diff --git a/tsconfig.json b/tsconfig.json index c133409..68b9fcf 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -22,6 +22,12 @@ "@/*": ["./src/*"] } }, - "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], + "include": [ + "svgr.d.ts", + "next-env.d.ts", + "**/*.ts", + "**/*.tsx", + ".next/types/**/*.ts" + ], "exclude": ["node_modules"] }