Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dev browser load time slow - decrease vendor.js file size?

Using Angular 8.0,

My browser load time with ng serve is about 15 seconds.

My browser load time with ng serve --prod is about 4 seconds.

In of the main differences that I see to cause the slow load time in dev is there is a vendor.js file that is 7 MB large.

What can be done to make the browser load time for dev less and closer to what I get to the prod build? Could some kind of modification be done to the tool chain where the vendor.js file is smaller?

like image 257
dman Avatar asked Feb 16 '26 20:02

dman


1 Answers

The only thing I have in mind is you probably depend on a lot of 3rd parties which not really tree-shakable.

Try loading using the optimizer in 'serve' as well.

In your angular.json file:

...
"serve": {
   "options": {
      "optimization": true
  }

}

You can also set up the aot prop to true just keep in mind that every save will build your app in AOT mode.

Hope that's help :)

like image 173
Eliran Eliassy Avatar answered Feb 19 '26 18:02

Eliran Eliassy