Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular Should I use the vendorChunk in production

Tags:

angular

I am using Angular6 and I was wondering if it was better to set "vendorChunk" to true or false in production. I know what it does, but I am not sure of the best value to use in production.

like image 336
Scipion Avatar asked Sep 05 '18 07:09

Scipion


1 Answers

It depends on your use case.

The advantage of not having a separate vendor chunk is that you'll be able to get a smaller bundle size. How much smaller depends on your app. I suggest trying a build with and without the flag to see if there is a significant difference.

On the other hand, the main advantage of having vendorChunk enabled is that the users will be able to only download the changed client code without the third party code(Which are less likely to be changed often).

In summary:

Set vendorChunk to true if:

  • You plan on updating the client code often without changing much of the third party libraries.

Set vendorChunk to false if:

  • There is a significant bundle size reduction by doing so
  • OR You are unlikely to change client code frequently
like image 120
nipuna777 Avatar answered Sep 16 '22 14:09

nipuna777