import type { NextConfig } from "next"; const appEnvironment=process.env.APP_ENV||(process.env.NODE_ENV==='development'?'development':'production'); if(!['development','test','production'].includes(appEnvironment))throw new Error('Invalid APP_ENV'); const nextConfig: NextConfig = { output: 'standalone', outputFileTracingExcludes: { '/*': ['./dist/**/*', './tests/**/*', './.next/cache/**/*', './.next-test/cache/**/*', './.next-dev/cache/**/*'], }, // Turbopack's route runtime is external; keep it in relocatable standalone releases. outputFileTracingIncludes: { '/*': ['./node_modules/next/dist/compiled/next-server/*runtime.prod.js'], }, distDir: appEnvironment==='development'?'.next-dev':appEnvironment==='test'?'.next-test':'.next', trailingSlash: true, // Page redirects live in src/proxy.ts; API and media URLs keep their exact paths. skipTrailingSlashRedirect: true, // Serve the complete page metadata in to browsers and crawlers alike. htmlLimitedBots: /.*/, images: { unoptimized: true }, poweredByHeader: false, turbopack: { root: process.cwd() }, async headers() { const xml=[{key:'Content-Type',value:'application/xml; charset=utf-8'}] const xsl=[{key:'Content-Type',value:'text/xsl; charset=utf-8'}] return [ {source:'/sitemap.xml',headers:xml}, {source:'/sitemaps/:file',headers:xml}, {source:'/static/sitemapindex.xsl',headers:xsl}, {source:'/static/sitemap.xsl',headers:xsl}, ] }, }; export default nextConfig;