vite 打包如何检查打包时的内存占用情况呢

2023-10-13 14:32:19 +08:00
 shui830
公司项目用 vue3+vite+cesium

build 的时候总是提示内存不够,于是使用
"build": "node --max_old_space_size=4096 node_modules/vite/bin/vite.js build"
暂时解决问题

但是今天打包又提示内存不够了,甚至我分配多少吃多少,12g 满了还是失败

postcss-px-to-viewport: postcss.plugin was deprecated. Migration guide:
https://evilmartians.com/chronicles/postcss-8-plugin-migration
vite v3.2.7 building for production...
transforming (3074) node_modules\d3-array\src\constant.jsUse of eval is strongly discouraged, as it poses security risks and may cause issues with minification
Use of eval is strongly discouraged, as it poses security risks and may cause issues with minification
✓ 3082 modules transformed.

<--- Last few GCs --->

[14884:000001F2FD8A4130] 123243 ms: Mark-sweep 11824.2 (12046.6) -> 11823.2 (12046.6) MB, 3763.9 / 0.0 ms (average mu = 0.633, current mu = 0.056) allocation failure scavenge might not succeed
[14884:000001F2FD8A4130] 129636 ms: Mark-sweep 11839.3 (12046.6) -> 11838.5 (12077.8) MB, 6387.8 / 0.0 ms (average mu = 0.366, current mu = 0.001) allocation failure scavenge might not succeed


<--- JS stacktrace --->

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
1: 00007FF7BCB30AAF v8::internal::CodeObjectRegistry::~CodeObjectRegistry+124015
2: 00007FF7BCABC866 v8::internal::wasm::WasmCode::safepoint_table_offset+64182
3: 00007FF7BCABD8E2 v8::internal::wasm::WasmCode::safepoint_table_offset+68402
4: 00007FF7BD3F1CE4 v8::Isolate::ReportExternalAllocationLimitReached+116
5: 00007FF7BD3DC2AD v8::SharedArrayBuffer::Externalize+781
6: 00007FF7BD27F88C v8::internal::Heap::EphemeronKeyWriteBarrierFromCode+1468
7: 00007FF7BD27C9A4 v8::internal::Heap::CollectGarbage+4244
8: 00007FF7BD27A320 v8::internal::Heap::AllocateExternalBackingStore+2000
9: 00007FF7BD29EEA6 v8::internal::Factory::NewFillerObject+214
10: 00007FF7BCFD1645 v8::internal::DateCache::Weekday+1797
11: 00007FF7BD47F9C1 v8::internal::SetupIsolateDelegate::SetupHeap+494417
12: 000001F2806E0C70

经验不足,找了半天也没找到如何分析哪里的问题,还请大手子教教我
523 次点击
所在节点    问与答
0 条回复

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/981695

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX