JavaScript heap out of memory in Angular 7 using Azure DevOps
Try to run prod build like this:
node --max_old_space_size=5048 ./node_modules/@angular/cli/bin/ng build --prod
I have the same error yesterday and it's helps me to avoid it.
Temporary solution to fix JavaScript heap memory issues are
ng node --max_old_space_size=4096 && ng build --prod
You can add more space as well
ng node --max_old_space_size=8192 && ng build --prod
Or disable AOT itself
ng build --prod --aot=false --build-optimizer=false
If you have problem with running the application using ng serve itself then use below command
node --max_old_space_size=8048 ./node_modules/@angular/cli/bin/ng serve
But my suggestion is to cross check your application design and verify all module import, external libraries are imported correctly. make sure there is no duplicate imports. Use shared module for all reusable components etc More info