dman
dman

Reputation: 11064

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?

Upvotes: 3

Views: 6823

Answers (1)

Eliran Eliassy
Eliran Eliassy

Reputation: 1600

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 :)

Upvotes: 6

Related Questions