Update next.config.mjs

This commit is contained in:
kleap-admin 2026-01-16 15:57:37 +00:00
parent f757ce8ac2
commit a5a295afad
1 changed files with 109 additions and 0 deletions

109
next.config.mjs Normal file
View File

@ -0,0 +1,109 @@
import nextMDX from "@next/mdx";
import path from "path";
/** @type {import('next').NextConfig} */
const nextConfig = {
experimental: {
optimizePackageImports: [
'lucide-react',
'react-icons',
'@tabler/icons-react',
'framer-motion',
'react-hook-form',
'@radix-ui/react-label',
'@radix-ui/react-slot',
],
},
reactStrictMode: false,
images: {
remotePatterns: [
{ protocol: 'https', hostname: 'i.pravatar.cc' },
{ protocol: 'https', hostname: 'images.unsplash.com' },
{ protocol: 'https', hostname: '*.supabase.co' },
{ protocol: 'https', hostname: 'www.robot-speed.com' },
{ protocol: 'https', hostname: 'robot-speed.com' },
],
formats: ['image/avif', 'image/webp'],
loader: 'default',
dangerouslyAllowSVG: true,
contentSecurityPolicy: "default-src 'self'; script-src 'none'; sandbox;",
},
pageExtensions: ["js", "jsx", "ts", "tsx", "md", "mdx"],
poweredByHeader: false,
compress: true,
typescript: {
ignoreBuildErrors: true
},
eslint: {
ignoreDuringBuilds: true
},
productionBrowserSourceMaps: false,
compiler: {
removeConsole: process.env.NODE_ENV === 'production' ? { exclude: ['error'] } : false,
reactRemoveProperties: process.env.NODE_ENV === 'production' ? { properties: ['^data-testid$'] } : false,
},
transpilePackages: ['geist', 'cobe'],
webpack: (config, { isServer, webpack }) => {
config.resolve.alias = {
...config.resolve.alias,
'@': path.resolve('.'),
'@components': path.resolve('./components'),
'@lib': path.resolve('./lib'),
'@constants': path.resolve('./constants'),
'@context': path.resolve('./context'),
};
const isVercel = !!(process.env.VERCEL || process.env.NEXT_PUBLIC_VERCEL || process.env.VERCEL_ENV);
const isProduction = process.env.NODE_ENV === 'production';
if (isVercel || isProduction) {
config.plugins.push(
new webpack.NormalModuleReplacementPlugin(
/tailwind-cdn-loader/,
path.resolve('./components/empty-loader.tsx')
)
);
}
return config;
},
async headers() {
return [
{
source: '/:path*',
headers: [
{ key: 'X-Frame-Options', value: 'ALLOWALL' },
{ key: 'Cache-Control', value: 'no-store, no-cache, must-revalidate, proxy-revalidate' },
{ key: 'Pragma', value: 'no-cache' },
{ key: 'Expires', value: '0' },
],
},
{
source: '/_next/static/:path*',
headers: [
{ key: 'Cache-Control', value: 'no-cache, no-store, must-revalidate' },
],
},
];
},
};
const withMDX = nextMDX({
extension: /\.mdx?$/,
options: {
remarkPlugins: [],
rehypePlugins: [],
},
});
export default withMDX(nextConfig);