fix(web): scope webpack SVG loader to packages/ui only
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:
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user