// next.config.ts
import type { NextConfig } from 'next';

const nextConfig: NextConfig = {
  images: {
    remotePatterns: [
      {
        protocol: 'https',
        hostname: 'yefranchisees.b-cdn.net',
        pathname: '/**',
      },
      {
        protocol: 'https',
        hostname: 'via.placeholder.com',
      },
      {
        protocol: 'http',
        hostname: 'via.placeholder.com',
      },
      {
        protocol: 'https',
        hostname: 'backend.youngengineers.org',
        pathname: '/**',
      },
    ],
    // ✅ DISABLE Next.js Image Optimization (causes 7.1s delays)
    // BunnyCDN has built-in optimization that's faster
    unoptimized: true,  // Use CDN optimization instead
  },
  // ✅ COMPRESSION
  compress: true,
  productionBrowserSourceMaps: false,
  
  // ✅ OPTIMIZATION
  onDemandEntries: {
    maxInactiveAge: 60 * 60 * 1000,
    pagesBufferLength: 5,
  },
};

export default nextConfig;