import type { NextConfig } from 'next' import bundleAnalyzer from '@next/bundle-analyzer' const withBundleAnalyzer = bundleAnalyzer({ enabled: process.env['ANALYZE'] === 'true', }) const nextConfig: NextConfig = { images: { remotePatterns: [ { protocol: 'https', hostname: 'images.unsplash.com', }, { protocol: 'https', hostname: 'www.lmdpro.com', }, { protocol: 'https', hostname: 'lmdpro.com', }, { protocol: 'https', hostname: 'lh3.googleusercontent.com', } ], formats: ['image/avif', 'image/webp'], minimumCacheTTL: 3600, }, // Production optimizations poweredByHeader: false, compress: true, generateEtags: true, // 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', }, { key: 'Permissions-Policy', value: 'camera=(), microphone=(), geolocation=()', }, ], }, { source: '/api/(.*)', headers: [ { key: 'Cache-Control', value: 'no-store, max-age=0', }, ], }, ]; }, // Redirects async redirects() { return [ { source: '/home', destination: '/', permanent: true, }, ]; }, // Build-time configuration typescript: { ignoreBuildErrors: process.env.NODE_ENV === 'development', }, eslint: { ignoreDuringBuilds: process.env.NODE_ENV === 'development', }, // Performance optimizations experimental: { optimizeCss: true, scrollRestoration: true, }, // Turbopack configuration (stable) turbopack: { rules: { '*.svg': { loaders: ['@svgr/webpack'], as: '*.js', }, }, }, // External packages for server components serverExternalPackages: ['@genkit-ai/googleai', 'genkit'], // Bundle analyzer webpack: (config, { isServer }) => { if (!isServer) { config.resolve.fallback = { fs: false, net: false, tls: false, }; } return config; }, // Compiler optimizations compiler: { removeConsole: process.env['NODE_ENV'] === 'production', }, // Enable standalone output for Docker (disabled for local development) // output: 'standalone', }; export default withBundleAnalyzer(nextConfig);