DieselDepot-APP/next.config.mjs

36 lines
1.2 KiB
JavaScript
Raw Normal View History

/** @type {import('next').NextConfig} */
const nextConfig = {
// Build outputs:
// NEXT_EXPORT=true → static export (for static-site hosts)
// (default) → standalone (for Docker / Node hosts like Coolify)
// Standalone bundles only the files Next.js needs at runtime, so the Docker
// image is much smaller than a full `node_modules` copy.
...(process.env.NEXT_EXPORT === 'true'
? { output: 'export' }
: { output: 'standalone' }),
images: { unoptimized: true },
trailingSlash: true,
// Headers to make the app work well as a PWA and to allow the camera/getUserMedia APIs.
async headers() {
return [
{
source: '/sw.js',
headers: [
{ key: 'Content-Type', value: 'application/javascript; charset=utf-8' },
{ key: 'Cache-Control', value: 'no-cache, no-store, must-revalidate' },
{ key: 'Service-Worker-Allowed', value: '/' },
],
},
{
source: '/(.*)',
headers: [
// Disable Permissions-Policy for getUserMedia so the camera works inside an iframe if needed.
{ key: 'Permissions-Policy', value: 'camera=(self), geolocation=(self)' },
],
},
];
},
};
export default nextConfig;