huozhi / bunchee

Zero config bundler for ECMAScript and TypeScript packages
https://npmjs.com/bunchee
859 stars 28 forks source link

Build crashing with OOM #533

Closed Makisuo closed 3 weeks ago

Makisuo commented 2 months ago

I have a package with a lot of entries and it seems to consume overly much Memory, aswell as crashing with Out of Memory since reaching some threshold of entry files.

Any way for me to limit bunchees concurrent building or setting Memory Limits for my builds to not crash from it?

@pixelshades/styles:build: <--- JS stacktrace --->
@pixelshades/styles:build: 
@pixelshades/styles:build: FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
@pixelshades/styles:build: ----- Native stack trace -----
@pixelshades/styles:build: 
@pixelshades/styles:build:  1: 0x100da959c node::Abort() [/Users/A200286255/Library/Application Support/fnm/node-versions/v20.11.1/installation/bin/node]

Here is also the package responsible for it:

https://github.com/telekom/pixelshades/blob/main/packages/styles/package.json

huozhi commented 1 month ago

@Makisuo I'm not seeing this problem with bunchee@5.1.5 which is used on main branch now, are you still seeing the issue?

Makisuo commented 1 month ago

Kinda fixed it by setting NODE_OPTIONS=--max-old-space-size=8192, but memory is spiking still super high at around ~5gb compared to the ~600mb for the other packages.

huozhi commented 1 month ago

I tested with removing that flag and it still works for me