/** @type {import('next').NextConfig} */ const nextConfig = { output: 'standalone', // Enable standalone output for optimized Docker builds // Optimize build performance with swcMinify swcMinify: true, // Limit the number of CPU cores used during production build experimental: { cpus: Math.max(1, Math.min(4, require('os').cpus().length - 1)), }, // Configure images for Supabase Storage URLs images: { domains: [ // Extract domain from NEXT_PUBLIC_SUPABASE_URL if available process.env.NEXT_PUBLIC_SUPABASE_URL ? new URL(process.env.NEXT_PUBLIC_SUPABASE_URL).hostname : '', ].filter(Boolean), // Remove empty entries // Optimize image formats for better performance formats: ['image/webp'], }, serverActions: { bodySizeLimit: '10mb', }, // Enable better caching for production builds poweredByHeader: false, reactStrictMode: true, // Optimize Webpack webpack: (config, { dev, isServer }) => { // Only enable cache during development if (dev) { config.cache = true; } // Optimize production build if (!dev) { config.optimization = { ...config.optimization, // Minimize hashing calculation time moduleIds: 'deterministic', // Minimize concurrent processing sideEffects: true, }; } return config; }, }; module.exports = nextConfig;