V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
shui830
V2EX  ›  问与答

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

  •  
  •   shui830 · 2023-10-13 14:32:19 +08:00 · 518 次点击
    这是一个创建于 402 天前的主题,其中的信息可能已经有所发展或是发生改变。
    公司项目用 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

    经验不足,找了半天也没找到如何分析哪里的问题,还请大手子教教我
    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1037 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 20:23 · PVG 04:23 · LAX 12:23 · JFK 15:23
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.