ng:build_project_that_needs_to_use_a_lot_of_memory

Build Project that Needs to Use a Lot of Memory

Normally, we build angular project with

ng build --prod --base-href /YOUR_BASE_HREF/ --env=prod

but ng command uses at most 4GB ram to build the source, and it might not enough for some big project. We can use node command directly to build it. Go to your project directory and try:

node --max_old_space_size=8192 node_modules/@angular/cli/bin/ng build  --prod --base-href /YOUR_BASE_HREF/ --env=prod

where 8192 is the memory you assign for node.js to build the project, you might assign even more if needed.

  • ng/build_project_that_needs_to_use_a_lot_of_memory.txt
  • Last modified: 2019/05/15 16:17
  • by chongtin