Why does the build script set NODE_OPTIONS=--max-old-space-size=8192?

Hi everyone,

I noticed that in packages/frontend/editor-ui/package.json, the build script is:

"build": "cross-env VUE_APP_PUBLIC_PATH=\"/{{BASE_PATH}}/\" NODE_OPTIONS=\"--max-old-space-size=8192\" vite build"

If I understand correctly, --max-old-space-size=8192 means Node.js is allowed to use up to 8GB of memory during the build process.

Could someone please explain why such a large memory limit is needed for building the frontend?
Is this due to the size of the project, specific Vite configurations, or to avoid common build failures?

Thanks in advance for any insights!

n8n’s frontend has grown over time, more components, more dependencies, more everything. Vite and the bundler (like esbuild or Rollup) can eat up a lot of memory while compiling and optimizing all those assets.

this could be to prevent build crashes. Without this memory limit, some people may run into “JavaScript heap out of memory” errors during the build. This flag helps make the build more stable, especially on machines or CI environments with enough RAM.

hope this answers your query

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.