import bundleAnalyzer from '@next/bundle-analyzer'; const withBundleAnalyzer = bundleAnalyzer({ enabled: process.env.ANALYZE === 'true', }); /** @type {import('next').NextConfig} */ const nextConfig = { // Image optimization configuration images: { remotePatterns: [], formats: ['image/avif', 'image/webp'], deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840], imageSizes: [16, 32, 48, 64, 96, 128, 256, 384], }, // Enable Partial Prerendering (PPR) via cacheComponents in Next.js 16 cacheComponents: true, // Compiler optimizations compiler: { // Remove console.log in production removeConsole: process.env.NODE_ENV === 'production' ? { exclude: ['error', 'warn'], } : false, }, // Headers for better caching async headers() { return [ { source: '/assets/:path*', headers: [ { key: 'Cache-Control', value: 'public, max-age=31536000, immutable', }, ], }, ]; }, }; export default withBundleAnalyzer(nextConfig);