fix(build): 深度优化构建配置,禁用 compressPublicAssets,取消 manualChunks,以彻底解决内存溢出问题
This commit is contained in:
+5
-18
@@ -279,7 +279,7 @@ export default defineNuxtConfig({
|
|||||||
|
|
||||||
// 服务器端配置
|
// 服务器端配置
|
||||||
nitro: {
|
nitro: {
|
||||||
compressPublicAssets: true,
|
compressPublicAssets: false, // 禁用公共资产压缩,防止构建时内存溢出
|
||||||
preset: process.env.VERCEL
|
preset: process.env.VERCEL
|
||||||
? 'vercel'
|
? 'vercel'
|
||||||
: process.env.NETLIFY
|
: process.env.NETLIFY
|
||||||
@@ -297,14 +297,11 @@ export default defineNuxtConfig({
|
|||||||
wasm: true,
|
wasm: true,
|
||||||
asyncContext: true
|
asyncContext: true
|
||||||
},
|
},
|
||||||
// 强制把巨型包和 native 包外置,防止 Nitro 打包时撑爆内存 (OOM 137)
|
// 强制把巨型 Node native 库外置,防止 Nitro 打包时撑爆内存 (OOM 137)
|
||||||
externals: {
|
externals: {
|
||||||
external: [
|
external: [
|
||||||
'drizzle-orm',
|
'drizzle-orm',
|
||||||
'postgres',
|
'postgres'
|
||||||
'h3',
|
|
||||||
'lucide-vue-next',
|
|
||||||
'@pixi/app'
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
timing: true,
|
timing: true,
|
||||||
@@ -409,18 +406,8 @@ export default defineNuxtConfig({
|
|||||||
target: 'esnext',
|
target: 'esnext',
|
||||||
reportCompressedSize: false,
|
reportCompressedSize: false,
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
maxParallelFileOps: 2,
|
maxParallelFileOps: 1,
|
||||||
cache: false,
|
cache: false
|
||||||
output: {
|
|
||||||
manualChunks(id) {
|
|
||||||
if (!id.includes('node_modules')) return
|
|
||||||
if (id.includes('lucide-vue-next')) return 'icons'
|
|
||||||
if (id.includes('@pixi')) return 'pixi'
|
|
||||||
if (id.includes('@applemusic-like-lyrics')) return 'lyric-engine'
|
|
||||||
if (id.includes('drizzle-orm') || id.includes('postgres')) return 'database'
|
|
||||||
if (id.includes('xlsx') || id.includes('jspdf') || id.includes('jszip')) return 'office'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
resolve: {
|
resolve: {
|
||||||
|
|||||||
Reference in New Issue
Block a user