import type { NextConfig } from 'next'; import createMDX from '@next/mdx'; import createNextIntlPlugin from 'next-intl/plugin'; const withNextIntl = createNextIntlPlugin('./src/i18n/request.ts'); const nextConfig: NextConfig = { output: 'standalone', outputFileTracingRoot: process.cwd(), // Enable React strict mode for better error detection reactStrictMode: true, // Temporarily ignore ESLint and TypeScript during build (pre-existing issues) eslint: { ignoreDuringBuilds: true, }, typescript: { ignoreBuildErrors: true, }, // Remove X-Powered-By header for security poweredByHeader: false, pageExtensions: ['js', 'jsx', 'md', 'mdx', 'ts', 'tsx'], images: { formats: ['image/avif', 'image/webp'], deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048], imageSizes: [16, 32, 48, 64, 96, 128, 256, 384], // Cache remote images for 30 days minimumCacheTTL: 60 * 60 * 24 * 30, remotePatterns: [ { protocol: 'https', hostname: 'mxadgucxhmstlzsbgmoz.supabase.co', }, ], }, experimental: { // Tree-shake large packages for smaller bundles optimizePackageImports: [ 'lucide-react', 'framer-motion', '@supabase/supabase-js', 'clsx', 'tailwind-merge', 'react-intersection-observer', ], }, async headers() { // Security headers for all routes // Note: Content-Security-Policy is handled by @next-safe/middleware in src/middleware.ts const securityHeaders = [ { key: 'X-DNS-Prefetch-Control', value: 'on', }, { key: 'X-Frame-Options', value: 'SAMEORIGIN', }, { key: 'X-Content-Type-Options', value: 'nosniff', }, { key: 'X-XSS-Protection', value: '1; mode=block', }, { key: 'Referrer-Policy', value: 'strict-origin-when-cross-origin', }, { // Enforce HTTPS (1 year, include subdomains, allow preload list) key: 'Strict-Transport-Security', value: 'max-age=31536000; includeSubDomains; preload', }, { // Restrict browser features for security key: 'Permissions-Policy', value: 'camera=(), microphone=(), geolocation=(), interest-cohort=()', }, ]; // Long-term caching for immutable assets const immutableCacheHeader = [ { key: 'Cache-Control', value: 'public, max-age=31536000, immutable', }, ]; return [ // Apply security headers to all routes { source: '/:path*', headers: securityHeaders, }, // Cache static assets aggressively { source: '/fonts/:path*', headers: immutableCacheHeader, }, { source: '/images/:path*', headers: immutableCacheHeader, }, { source: '/_next/static/:path*', headers: immutableCacheHeader, }, // Content-Language headers for SEO (important for Bing and other search engines) { source: '/de/:path*', headers: [ { key: 'Content-Language', value: 'de-DE', }, ], }, { source: '/en/:path*', headers: [ { key: 'Content-Language', value: 'en-US', }, ], }, { source: '/sr/:path*', headers: [ { key: 'Content-Language', value: 'sr-RS', }, ], }, ]; }, // Compiler optimizations compiler: { removeConsole: process.env.NODE_ENV === 'production', }, }; const withMDX = createMDX({ options: { remarkPlugins: [], rehypePlugins: [], }, }); export default withNextIntl(withMDX(nextConfig));