How much RAM for angular build is fine?

444 views Asked by At

We encountered an issue while building our Angular Apps, it consumes too much memory, about 8 gigs for average project. Before blaming AngularCLI, creating a ticket and asking for help, I just want to know how much is too much for an average angular build?

The problem became sufficient when you're building it in the CI, where RAM is limited (we use a Bitbucket which has 8 gigs of ram max)

The memory consumption of ng build command looks as following:

  1. about 3-4 gigs on the building phase
  2. then it quickly rump-up up to 8gigs on the "sealing" phase

Disabling optimisation: false in angular.json helps to reduce max heap size to 3-4 gigs, but that left our bundles not minified and mangled, which is not acceptable.

I tried to create a heap snapshot when it consumes 7.8 gigs, but it took hours and didn't finish.

The project has about 20mb of the vendors (not optimized, so without tree-shaking and gzipping) and around 10mb of user's code.

0

There are 0 answers