import type { NextConfig } from 'next'; const basePath = process.env.NEXT_PUBLIC_BASE_PATH || ''; if (basePath && !/^(?:\/[A-Za-z0-9][A-Za-z0-9_-]*)+$/.test(basePath)) throw new Error('NEXT_PUBLIC_BASE_PATH 必须为空或类似 /demands 的路径,不含末尾斜线。'); const config: NextConfig = { basePath, output: 'standalone', poweredByHeader: false, outputFileTracingIncludes: { '/api/documents/*': ['./content/docs/*.md', './content/word/*.docx'] }, 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=()'}, ]}]; }, }; export default config;