mhsf-dev/next.config.mjs

46 lines
1.2 KiB
JavaScript
Raw Normal View History

import MangleCssClassPlugin from "mangle-css-class-webpack-plugin";
2024-05-31 16:22:34 -05:00
/** @type {import('next').NextConfig} */
2024-07-23 18:49:21 -05:00
const nextConfig = {
images: {
remotePatterns: [
{
protocol: "https",
hostname: "img.clerk.com",
},
],
},
webpack: (config, { dev }) => {
config.resolve.modules.push(path.resolve("./"));
if (!dev) {
config.plugins.push(
new MangleCssClassPlugin({
classNameRegExp:
"(([a-zA-Z-:]*)[\\\\\\\\]*:)*([\\\\\\\\]*!)?tw-[a-zA-Z-]([a-zA-Z0-9-]*([\\\\\\\\]*(\\%|\\#|\\.|\\[|\\]))*)*",
// ignorePrefixRegExp: "((hover|focus|active|disabled|visited|first|last|odd|even|group-hover|focus-within|xs|sm|md||lg|xl)(\\\\\\\\\\\\\\\\|\\\\)?:)*",
classGenerator: (original, opts, context) => {
if (classNames[original]) {
return classNames[original];
}
let nextId;
do {
// Class name cannot start with a number.
nextId = `cfk-${Math.random()}`;
} while (/^[0-9_-]/.test(nextId));
return (classNames[original] = nextId);
},
// log: true
})
);
}
return config;
},
2024-07-23 18:49:21 -05:00
};
2024-05-31 16:22:34 -05:00
export default nextConfig;