Files
gridpilot.gg/apps/website/next.config.mjs
2026-01-19 12:35:16 +01:00

97 lines
2.3 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,
output: 'standalone',
// Fix for monorepos: point tracing to repo root (portable across machines/containers)
outputFileTracingRoot: path.join(__dirname, '../..'),
images: {
unoptimized: process.env.NODE_ENV === 'development' || process.env.DOCKER_SMOKE === 'true',
remotePatterns: [
{
protocol: 'https',
hostname: 'placehold.co',
},
{
protocol: 'https',
hostname: 'picsum.photos',
},
{
protocol: 'http',
hostname: 'localhost',
port: '3000',
},
{
protocol: 'http',
hostname: 'localhost',
port: '3001',
},
{
protocol: 'http',
hostname: 'localhost',
port: '3100',
},
{
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() {
// Use API_BASE_URL if set, otherwise use internal Docker URL
const baseUrl = process.env.API_BASE_URL || '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',
});
// Add path aliases to fix build issues
config.resolve.alias = {
...config.resolve.alias,
'@': path.resolve(__dirname, '.'),
'@lib': path.resolve(__dirname, 'lib'),
'@hooks': path.resolve(__dirname, 'hooks'),
'@components': path.resolve(__dirname, 'components'),
'@app': path.resolve(__dirname, 'app'),
'@templates': path.resolve(__dirname, 'templates'),
'@types': path.resolve(__dirname, 'types'),
};
return config;
},
};
export default nextConfig;