chore: update svgr options

This commit is contained in:
2026-05-28 11:31:03 -07:00
parent 7c38c94a9b
commit c7e046f1c2
+20 -4
View File
@@ -1,22 +1,38 @@
import type { NextConfig } from "next"; import type { NextConfig } from "next";
// SVGR rewrites hardcoded black/white fills to `currentColor` so SVGs
// inherit the surrounding CSS `color` (Tailwind's text-*) like Tabler icons do.
const svgrOptions = {
replaceAttrValues: {
"#000": "currentColor",
"#000000": "currentColor",
black: "currentColor",
"#fff": "currentColor",
"#ffffff": "currentColor",
white: "currentColor",
},
};
const nextConfig: NextConfig = { const nextConfig: NextConfig = {
// Turbopack (default in `next dev` and `next build` on Next 16)
turbopack: { turbopack: {
rules: { rules: {
"*.svg": { "*.svg": {
loaders: ["@svgr/webpack"], loaders: [
{
loader: "@svgr/webpack",
options: svgrOptions,
},
],
as: "*.js", as: "*.js",
}, },
}, },
}, },
// Webpack fallback — used if anyone opts out of Turbopack via `next build --no-turbopack`
webpack(config) { webpack(config) {
config.module.rules.push({ config.module.rules.push({
test: /\.svg$/i, test: /\.svg$/i,
issuer: /\.[jt]sx?$/, issuer: /\.[jt]sx?$/,
use: ["@svgr/webpack"], use: [{ loader: "@svgr/webpack", options: svgrOptions }],
}); });
return config; return config;
}, },