fix(web): scope webpack SVG loader to packages/ui only
Some checks failed
CI / Lint (push) Has been cancelled
CI / Typecheck (push) Has been cancelled
CI / Broker tests (Postgres) (push) Has been cancelled
CI / Docker build (linux/amd64) (push) Has been cancelled

Exclude app/ SVGs (icon.svg, opengraph) from @svgr/webpack —
Next.js metadata loader handles those. Only transform flag/logo
SVGs from packages/ui/.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Alejandro Gutiérrez
2026-04-09 13:01:00 +01:00
parent e3fa6e6a5e
commit 05e3c43e29

View File

@@ -102,10 +102,19 @@ const config: NextConfig = {
}, },
}, },
// Webpack SVG loader (used when TURBOPACK=0 for production builds) // Webpack SVG loader (used when TURBOPACK=0 for production builds).
// Exclude app/ dir SVGs (icon.svg, opengraph-image) — Next.js metadata
// loader handles those. Only process package SVGs (flags, logos).
webpack(config) { webpack(config) {
const existingSvgRule = config.module.rules.find(
(rule: { test?: RegExp }) => rule.test?.test?.(".svg"),
);
if (existingSvgRule) {
existingSvgRule.exclude = /packages\/ui\/.*\.svg$/;
}
config.module.rules.push({ config.module.rules.push({
test: /\.svg$/, test: /\.svg$/,
include: /packages\/ui\//,
use: ["@svgr/webpack"], use: ["@svgr/webpack"],
}); });
return config; return config;