// Package images are served by edr-passenger-api's own origin (public/uploads/packages via // app.useStaticAssets — see apps/edr-passenger-api/src/main.ts), a different origin than this // app, so next/image needs it explicitly whitelisted or it 400s every package image at runtime. const API_URL = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:4000'; let apiImagePattern; try { const apiUrl = new URL(API_URL); apiImagePattern = { protocol: apiUrl.protocol.replace(':', ''), hostname: apiUrl.hostname, port: apiUrl.port || '', pathname: '/uploads/**', }; } catch { apiImagePattern = { protocol: 'http', hostname: 'localhost', port: '4000', pathname: '/uploads/**' }; } /** @type {import('next').NextConfig} */ const nextConfig = { output: 'standalone', reactStrictMode: true, transpilePackages: ['@edr/types', '@edr/ui-common'], images: { unoptimized: false, remotePatterns: [apiImagePattern], }, }; export default nextConfig;