NPM run build over 100% cpu

Viewed 2325

when i run command npm run build, ng command use a lot cpu

1

how to fix it, sorry for my english and thanks for watching.

2 Answers

The fact that the production build uses a lot of your CPU is a good sign, it means that the production build is effectively trying to do the proper optimizations.

For development purposes, when you want the build to be much quicker, you should switch to a non-prod build

See your packages.json file, but essentially you should create or look for a build-dev script that calls ng build without --prod option.

you can limit the ram usage like

node --max_old_space_size=400 ng build

Related