Angular 4 CLI too slow after ng serve and when updating

You have this problem is because your dev PC have not enough memory to handle the build as nodejs is consuming a lot of memory when you run expensive npm tasks. And the bigger your project the more memory is required to complete the task. The problem can get even worse if you want to run ng serve + ng t + ng whatewer at the same time.

Check the Task manager -> Perfomrmance tab then run ng serve and you will see what I am talking about.

I had struggled by the same problem until I put another 8gb RAM in my dev PC.

So yes it is normal.


i solved my problem. What happened is that our components and other resources are all imported in app.module.ts. Because of this, the page loads all the resources every time the page loads. My solution was to apply Lazy Loading to load only those resources that are specific to the routes that i am accessing and it did fix up the loading issue.


You Just Need to update angular cli version I hope this will solve your issue

 npm install @angular/cli@latest     

If this one Does not solve your Issue Means Just Run using this Cmd

 ng serve --sourceMap=false