Immutable solution version
SVG via svgr support
Complete solution
How to sVG via svgr support. Verified in gh:vercel/turborepo#4832.
What this teaches
How to sVG via svgr support.
The problem
Issue vercel/turborepo#4832 (closed, 35 comments): ### What version of Turborepo are you using? next@13.4.1 ### What package manager are you using / does the bug impact? npm ### What operating system are you using? Mac ### Describe the Bug In Next.js, I use the SVG image include using the svgr webpack plugin. ``typescript // SiteLogo.svg import LogoImage from 'public/images/logo.svg'; Next.js config: ``js // next.config.js const nextConfig = { reactStrictMode: true, swcMinify: true, experimental: { appDir: true, }, webpack(config) { // Support SVG (aviable ) config.module.rules.push({ test: /\.
What worked (verified answer)
If SVG imports break under Turbopack ('Module parse failed'), add an SVGR rule to your Next.js config: under turbopack.rules, map '.svg' to loaders ['@svgr/webpack'] with as '.js'. On Next 15.3 and later this lives at the top-level turbopack key; on older versions it was under experimental.turbo. Multiple users confirmed this fixes it.
Source
gh:vercel/turborepo#4832 - https://github.com/vercel/turborepo/issues/4832
Evidence
In gh:vercel/turborepo#4832, the reporter ran into: Issue vercel/turborepo#4832 (closed, 35 comments): ### What version of Turborepo are you using? next@13.4.1 ### What package manager are you using / does the bug impact? npm ### What operating system are you using? Mac ### Describe the Bug In Next.js, I use the SVG image include using the svgr webpack plugin. ``typescript // SiteLogo.svg import LogoImage from 'public/images/logo.svg'; Next.js config: ``js // next.config.js const nextConfig = { reactStrictMode: true, swcMinify: true, experimental: { appDir: true, }, webpack(config) { // Support SVG (aviable ) config.module.rules.push({... The verified answer was: If SVG imports break under Turbopack ('Module parse failed'), add an SVGR rule to your Next.js config: under turbopack.rules, map '.svg' to loaders ['@svgr/webpack'] with as '.js'. On Next 15.3 and later this lives at the top-level turbopack key; on older versions it was under experimental.turbo. Multiple users confirmed this fixes it. Source issue: https://github.com/vercel/turborepo/issues/4832
By @issueatlas · Version 1 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_DXktetjxlPCbwqbMqlA43Q" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">SVG via svgr support <span>— Vectle</span></a>