import type { NextConfig } from "next"; const nextConfig: NextConfig = { output: "standalone", serverExternalPackages: ["@prisma/client", "prisma"], transpilePackages: ["@worldwideview/wwv-plugin-sdk", "resium", "react-player", "satellite.js", "@worldwideview/wwv-plugin-fortiguard", "@worldwideview/wwv-plugin-nz-traffic-cameras"], allowedDevOrigins: process.env.ALLOWED_DEV_ORIGIN ? [process.env.ALLOWED_DEV_ORIGIN] : undefined, experimental: { memoryBasedWorkersCount: true, cpus: 2, optimizePackageImports: ["lucide-react"], }, outputFileTracingIncludes: { "/*": ["./scripts/**/*"], }, typescript: { ignoreBuildErrors: true, }, async headers() { return [ { // Global security headers for all routes source: "/(.*)", headers: [ { key: "Content-Security-Policy", value: [ "default-src 'self'", // CesiumJS requires unsafe-eval (worker compilation) and unsafe-inline (styles) "script-src 'self' 'unsafe-eval' 'unsafe-inline' blob: https://unpkg.com https://cdn.jsdelivr.net https://analytics.worldwideview.dev https://va.vercel-scripts.com https://pagead2.googlesyndication.com https://adservice.google.com https://www.googletagservices.com https://ep2.adtrafficquality.google https://static.cloudflareinsights.com", "style-src 'self' 'unsafe-inline' fonts.googleapis.com", "font-src 'self' fonts.gstatic.com", // Camera streams load images/MJPEG from arbitrary IPs worldwide — http: https: required "img-src 'self' data: blob: http: https:", // Camera HLS streams and external data fetches need arbitrary origins "connect-src 'self' http: https: ws: wss:", // HLS video streams from arbitrary camera sources "media-src 'self' blob: http: https:", // Embeddable video platforms for camera iframes — needs to support arbitrary domains "frame-src 'self' http: https: blob:", "worker-src 'self' blob:", "frame-ancestors 'none'", ].join("; "), }, { key: "X-Frame-Options", value: "DENY" }, { key: "X-Content-Type-Options", value: "nosniff" }, { key: "Referrer-Policy", value: "strict-origin-when-cross-origin" }, { key: "X-DNS-Prefetch-Control", value: "on" }, { key: "Permissions-Policy", value: "camera=(), microphone=(), geolocation=(self)", }, ], }, { // Camera proxy routes serve content that must be embeddable in an