/** @type {import('next').NextConfig} */ const nextConfig = { output: 'standalone', productionBrowserSourceMaps: false, compress: true, swcMinify: true, eslint: { // 在生产构建时忽略ESLint错误 ignoreDuringBuilds: true, }, typescript: { // 在生产构建时忽略TypeScript错误(如果需要) // ignoreBuildErrors: true, }, images: { remotePatterns: (() => { const hosts = (process.env.IMAGE_REMOTE_HOSTS || '').split(',').map(s => s.trim()).filter(Boolean) const defaults = ['s3.1080p.hk', '45.249.208.118', 'localhost'] // 添加服务器IP和localhost支持 const all = Array.from(new Set([...defaults, ...hosts])) const patterns = [] for (const h of all) { patterns.push({ protocol: 'https', hostname: h }) patterns.push({ protocol: 'http', hostname: h }) } return patterns })(), }, experimental: { serverActions: { bodySizeLimit: '10gb', // Server Actions 的限制 (10GB) }, }, // 允许构建时出现预渲染错误(这些页面会在运行时动态渲染) onDemandEntries: { maxInactiveAge: 25 * 1000, pagesBufferLength: 2, }, // 注意:CORS配置移到middleware.ts中处理,因为需要动态设置origin // 当使用credentials时,不能使用通配符* } module.exports = nextConfig