Running out of memory in build step of SvelteKit App (Workers)
We're trying to build our SvelteKit-based app from our Monorepo (Turborepo) with Workers Builds, but are facing the typical Node OOM errors as we're seemingly hitting the 8GB limit inside the build step.
Running the same process with busted caches, mirrored commands and everything leads to ~4GB of used memory at the end of bundling the whole application on my local machine (Macbook Pro M1).
We haven't had this issue with our old builds with Pages, but wanted to move to the new builds and Workers runtime as it provides better logging out of the box and is now recommended on the CF dashboard.
Is there something that eats the other half that can't be removed, or are there some gotchas to be aware of when it comes to Workers Builds at this stage?
Below are the errors from the Node GC (fails towards the end of the Rollup process):
2 Replies
You can set a build variable
NODE_OPTIONS with the content --max-old-space-size=6144. This resolved the issues for me.Ty that solved it @Rhaegal , I thought it was set to 8GB out of the box, for some reason when reading the forums