/** @type {import('next').NextConfig} */ import path from 'path'; import { fileURLToPath } from 'url'; const __dirname = path.dirname(fileURLToPath(import.meta.url)); const nextConfig = { reactStrictMode: true, // Fix for monorepos: point tracing to repo root (portable across machines/containers) outputFileTracingRoot: path.join(__dirname, '../..'), images: { remotePatterns: [ { protocol: 'https', hostname: 'placehold.co', }, { protocol: 'https', hostname: 'picsum.photos', }, ], dangerouslyAllowSVG: true, contentSecurityPolicy: "default-src 'self'; script-src 'none'; sandbox;", contentDispositionType: 'inline', }, async rewrites() { const rawBaseUrl = process.env.API_BASE_URL ?? process.env.NEXT_PUBLIC_API_BASE_URL ?? 'http://localhost:3001'; const baseUrl = rawBaseUrl.endsWith('/') ? rawBaseUrl.slice(0, -1) : rawBaseUrl; return [ { source: '/api/media/:path*', destination: `${baseUrl}/media/:path*`, }, ]; }, typescript: { ignoreBuildErrors: false, }, eslint: { ignoreDuringBuilds: true, }, webpack: (config) => { config.module.rules.push({ test: /\.(mp4|webm)$/, type: 'asset/resource', }); return config; }, }; export default nextConfig;