gongxiangp2/next.config.js
chenpei 4712175cb0 feat(素材链路): 发布白底图双轨与AI生图回传能力
- 完成白底图 WebP 双轨接口、上传链路与预览缓存改造
- 新增 AI 生图平台成品回传接口、任务状态与表单规则
- 补齐 AI 生成标签、任务详情补全、相关测试与对接文档
2026-03-25 10:28:02 +08:00

110 lines
2.6 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/** @type {import('next').NextConfig} */
const nextConfig = {
output: 'standalone',
// 优化 standalone 输出,排除不必要的文件
experimental: {
outputFileTracingExcludes: {
'*': [
// 排除本地上传文件
'uploads/**',
// 排除构建缓存
'.build-cache/**',
'.docker-cache/**',
// 排除开发工具
'.kiro/**',
'.cursor/**',
'.vscode/**',
'.git/**',
// 排除测试文件
'__tests__/**',
'**/*.test.ts',
'**/*.test.tsx',
'**/*.spec.ts',
'**/*.spec.tsx',
// 排除文档和脚本
'docs/**',
'scripts/**',
'backups/**',
// 排除 Prisma 不必要的文件
'prisma/migrations/**',
'prisma/engine-cache/**',
// 排除部署脚本
'*.ps1',
'*.sh',
'docker-compose*.yml',
'Dockerfile*',
],
},
},
images: {
remotePatterns: [
{
protocol: 'https',
hostname: 's3.1080p.hk',
},
{
protocol: 'http',
hostname: 's3.1080p.hk',
},
{
protocol: 'https',
hostname: 's3.yydd.ai',
},
{
protocol: 'http',
hostname: 's3.yydd.ai',
},
{
protocol: 'https',
hostname: 's3.jiansun.vip',
},
{
protocol: 'http',
hostname: 's3.jiansun.vip',
},
],
},
experimental: {
// 启用 instrumentation hook(应用启动时执行)
instrumentationHook: true,
serverActions: {
bodySizeLimit: '10gb', // Server Actions 的限制 (10GB)
},
},
// 增加 API Routes 的 body size 限制(默认 10MB,改为 100MB)
proxyClientMaxBodySize: 100 * 1024 * 1024, // 100MB,足够容纳 50MB 分片
// 注意:CORS配置移到middleware.ts中处理,因为需要动态设置origin
// 当使用credentials时,不能使用通配符*
// 添加版本号到静态资源文件名,强制浏览器更新
generateBuildId: async () => {
// 使用时间戳作为构建ID,确保每次部署都有新的版本号
return `build-${Date.now()}`
},
// 配置 headers 来禁用缓存
async headers() {
return [
{
source: '/:path*',
headers: [
{
key: 'X-Content-Type-Options',
value: 'nosniff',
},
{
key: 'X-Frame-Options',
value: 'SAMEORIGIN',
},
{
key: 'X-XSS-Protection',
value: '1; mode=block',
},
],
},
]
},
}
module.exports = nextConfig