/** @type {import('next').NextConfig} */ const nextConfig = { experimental: { appDir: true, }, // Enable React strict mode for better development experience reactStrictMode: true, // Optimize images images: { formats: ['image/webp', 'image/avif'], domains: [], dangerouslyAllowSVG: true, contentSecurityPolicy: "default-src 'self'; script-src 'none'; sandbox;", }, // Optimize CSS swcMinify: true, // Bundle analyzer (uncomment to analyze bundle) // bundleAnalyzer: { // enabled: process.env.ANALYZE === 'true', // }, // Compiler options for better performance compiler: { // Remove console.log in production removeConsole: process.env.NODE_ENV === 'production', }, // Output configuration for Docker deployment output: 'standalone', // Enable experimental features for better performance experimental: { optimizeCss: true, optimizePackageImports: ['antd', 'framer-motion', 'lucide-react'], }, // Headers for security and performance async headers() { return [ { source: '/(.*)', headers: [ { key: 'X-Frame-Options', value: 'DENY', }, { key: 'X-Content-Type-Options', value: 'nosniff', }, { key: 'Referrer-Policy', value: 'strict-origin-when-cross-origin', }, ], }, ]; }, // Webpack configuration for optimal bundling webpack: (config, { dev, isServer }) => { // Optimize bundle splitting if (!dev && !isServer) { config.optimization.splitChunks = { chunks: 'all', cacheGroups: { default: { minChunks: 1, priority: -20, reuseExistingChunk: true, }, vendor: { test: /[\\/]node_modules[\\/]/, name: 'vendors', priority: -10, chunks: 'all', }, antd: { name: 'antd', test: /[\\/]node_modules[\\/]antd[\\/]/, priority: 10, chunks: 'all', }, framerMotion: { name: 'framer-motion', test: /[\\/]node_modules[\\/]framer-motion[\\/]/, priority: 10, chunks: 'all', }, }, }; } return config; }, }; module.exports = nextConfig;