chore: update svgr options
This commit is contained in:
+20
-4
@@ -1,22 +1,38 @@
|
||||
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 = {
|
||||
// Turbopack (default in `next dev` and `next build` on Next 16)
|
||||
turbopack: {
|
||||
rules: {
|
||||
"*.svg": {
|
||||
loaders: ["@svgr/webpack"],
|
||||
loaders: [
|
||||
{
|
||||
loader: "@svgr/webpack",
|
||||
options: svgrOptions,
|
||||
},
|
||||
],
|
||||
as: "*.js",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// Webpack fallback — used if anyone opts out of Turbopack via `next build --no-turbopack`
|
||||
webpack(config) {
|
||||
config.module.rules.push({
|
||||
test: /\.svg$/i,
|
||||
issuer: /\.[jt]sx?$/,
|
||||
use: ["@svgr/webpack"],
|
||||
use: [{ loader: "@svgr/webpack", options: svgrOptions }],
|
||||
});
|
||||
return config;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user