Files
gridpilot.gg/apps/website/next.config.mjs
2025-12-31 15:39:28 +01:00

79 lines
1.8 KiB
JavaScript

/** @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: {
unoptimized: process.env.NODE_ENV === 'development',
remotePatterns: [
{
protocol: 'https',
hostname: 'placehold.co',
},
{
protocol: 'https',
hostname: 'picsum.photos',
},
{
protocol: 'http',
hostname: 'localhost',
port: '3000',
},
{
protocol: 'http',
hostname: 'localhost',
port: '3001',
},
{
protocol: 'https',
hostname: 'api.gridpilot.io',
},
{
protocol: 'http',
hostname: 'api',
port: '3000',
},
],
dangerouslyAllowSVG: true,
contentSecurityPolicy: "default-src 'self'; script-src 'none'; sandbox;",
contentDispositionType: 'inline',
},
async rewrites() {
// Always use the internal Docker API URL in development
// This ensures the website container can fetch images during optimization
const baseUrl = 'http://api:3000';
return [
{
source: '/api/:path*',
destination: `${baseUrl}/:path*`,
},
{
source: '/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;