Repository navigation
fix: give the renderer Vite build a 4 GiB heap - #52
Conversation
The Office editors (#49) grew the renderer module graph to 7k+ modules. Vite keeps all of it in memory while transforming, and Node's default old-space cap is ~2 GiB on hosts with less than 16 GB of RAM — the GitHub macOS runners — so both macOS Package jobs died with "JavaScript heap out of memory". The Windows runner has 16 GB, where V8 doubles the default to 4 GiB, which is why the same commit packaged fine there. Pass --max-old-space-size=4096 to the Vite subprocess; peak RSS is ~3.5 GB at 7118 modules, which fits the 7 GB arm64 runner. A caller that already sets a limit in NODE_OPTIONS keeps it. Only the build subprocess is affected, never the installed app.
|
Package run on this branch (platform=all, smoke=false, sign=false): https://github.com/bitsky-tech/bridgic-agent/actions/runs/37941736117 |
|
Result of https://github.com/bitsky-tech/bridgic-agent/actions/runs/37941736117 (platform=all, smoke=false, sign=false):
Both macOS jobs now get through the Vite build that killed the previous run on That is an Apple Developer account state, not a build problem: the team's Account Holder has to accept the updated Program License Agreement at developer.apple.com (Agreements, Tax, and Banking). The |
Problem
The last
Packagerun onmain(824425b, run 37932191206) failed on both macOS jobs while Vite was transforming the renderer:The Windows job on the same commit passed, and the
Packagerun onci/windows-codesign(2046320, which predates #49) passed on all three platforms.Cause
#49 added the Office editors (Univer presets, exceljs, mammoth, pptxgenjs, fabric, ...) and three new HTML entries. The renderer module graph is now 7118 modules, and Vite keeps all of it in memory during the transform phase.
Node's default old-space heap cap is ~2 GiB on 64-bit hosts with less than 16 GB of RAM, and V8 doubles it to 4 GiB only at 16 GB or more. The GitHub macOS runners have 7 GB (arm64) and 14 GB (Intel), so they get 2 GiB; the Windows runner has 16 GB and gets 4 GiB. That is the whole platform difference.
Validatedoes not run the production build, so #49 was green.Fix
electron-build-renderer.tspasses--max-old-space-size=4096to the Vite subprocess viaNODE_OPTIONS. An explicit heap limit already present in the caller'sNODE_OPTIONSis kept. Only the build subprocess is affected; the installed app's runtime heap is unchanged.Validation
Local reproduction on
main(Node 24, 24 GB host),vite buildof the renderer with an explicit heap cap:On this branch:
bun run test: 2710 pass, 6 skip, 0 fail (3 new tests cover the env construction)bun run typecheck,bun run lint,bun run check:chinese: passbun run buildend to end: pass, peak RSS 3.6 GBPackagedispatched on this branch withplatform=all: see the run linked in the comments belowRelation to #51
#51 solves the same failure by building the four pages in separate Vite processes. Per its own description, the Excel page alone still needs a 4 GiB heap, so that approach also raises the limit while changing the output layout and duplicating shared dependencies across pages (34.8 MiB to 47.7 MiB of assets). This PR raises the limit alone and leaves the bundle as it is.