This commit is contained in:
eric
2026-03-23 22:59:42 -05:00
parent 614f001986
commit 0528b1853a
8 changed files with 54 additions and 13 deletions

View File

@@ -1,8 +1,22 @@
import type { NextConfig } from "next";
/** 由 scripts/build-safe.cjs 设置;在 VPS 上也可手动 export 后执行 pnpm build */
const lowMemBuild = process.env.NEXT_BUILD_LOW_MEM === "1";
const nextConfig: NextConfig = {
experimental: {
serverActions: { bodySizeLimit: "25mb" },
...(lowMemBuild
? {
// 限制并行与预渲染并发降低峰值内存Next 16 默认 Turbopack 构建)
cpus: 1,
turbopackMemoryLimit: 1536 * 1024 * 1024,
staticGenerationMaxConcurrency: 1,
webpackMemoryOptimizations: true,
parallelServerCompiles: false,
parallelServerBuildTraces: false,
}
: {}),
},
async headers() {
const noCacheHeaders = [