I'm encountering a strange issue when switching my Angular build system from Webpack to ESBuild.
When using:
"builder": "@angular-devkit/build-angular:browser"
Everything works fine, and RAM usage stays below 1GB.
However, when switching to:
"builder": "@angular-devkit/build-angular:browser-esbuild"
The RAM usage skyrockets to over 16GB, causing performance issues.
I narrowed it down to script optimization. If I disable it:
"optimization": {
"scripts": false,
"styles": true
}
The RAM usage remains under 1GB, but as soon as script optimization is enabled, the memory spikes again.
Additional Details:
- Webpack (browser) does not generate any warnings or errors.
- ESBuild (browser-esbuild) completes without errors, but with extreme RAM usage.
- The issue is only triggered when script optimization is enabled.
- I'm using the latest Angular version with ESBuild.
Has anyone experienced a similar issue, or does anyone know how to mitigate this high memory usage with ESBuild optimization?
P.S. Maybe it's related issue but not sure: Memory usage grows exponentially of the esbuild process. Any suggestion appreciated!