import path from 'node:path' import { fileURLToPath } from 'node:url' import type { NextConfig } from 'next' import bundleAnalyzer from '@next/bundle-analyzer' const withBundleAnalyzer = bundleAnalyzer({ enabled: process.env.ANALYZE === 'true' }) const nextConfig: NextConfig = { // Standalone-Build fuer das Container-Image, siehe docker/web.Dockerfile. output: 'standalone', // fileURLToPath statt URL.pathname: der Projektpfad enthält ein Leerzeichen, // das pathname als %20 stehen ließe. Der Standalone-Build landete dadurch in // einem falsch benannten Unterordner. outputFileTracingRoot: path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..'), reactStrictMode: true, poweredByHeader: false, // Der Cloudflare Tunnel komprimiert, im Stack ist dafuer nichts zu tun. compress: false, experimental: { // Autoren-, Rollen- und Vorlagendaten werden prozesslokal gecacht, // siehe docs/09-performance-und-ux.md. staleTimes: { dynamic: 30, static: 180 }, }, async headers() { return [ { source: '/:path*', headers: [ { key: 'X-Content-Type-Options', value: 'nosniff' }, { key: 'Referrer-Policy', value: 'same-origin' }, { key: 'X-Frame-Options', value: 'DENY' }, { key: 'Permissions-Policy', value: 'camera=(), microphone=(), geolocation=(), interest-cohort=()', }, ], }, { // Selbst gehostete Schriften sind unveraenderlich. source: '/fonts/:file*', headers: [{ key: 'Cache-Control', value: 'public, max-age=31536000, immutable' }], }, ] }, } export default withBundleAnalyzer(nextConfig)