/** @type {import('next').NextConfig} */ const nextConfig = { // Image optimization configuration images: { remotePatterns: [], formats: ['image/avif', 'image/webp'], // Optimized sizes for better performance deviceSizes: [640, 750, 828, 1080, 1200, 1920], imageSizes: [16, 32, 48, 64, 96, 128, 256], // Enable image optimization minimumCacheTTL: 60, }, // 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', }, ], }, { source: '/:path*', headers: [ { key: 'Cache-Control', value: 'public, max-age=0, must-revalidate', }, ], }, { source: '/blog/:slug*', headers: [ { key: 'Cache-Control', value: 'public, max-age=3600, stale-while-revalidate=86400', }, ], }, { source: '/pages/:slug*', headers: [ { key: 'Cache-Control', value: 'public, max-age=3600, stale-while-revalidate=86400', }, ], }, ]; }, }; export default nextConfig;