我应该在生产中使用vendorChunk吗 [英] Angular Should I use the vendorChunk in production

查看:649
本文介绍了我应该在生产中使用vendorChunk吗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Angular6,我想知道在生产环境中将"vendorChunk"设置为true还是false会更好.我知道它的作用,但是我不确定在生产中使用的最佳价值.

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.

推荐答案

这取决于您的用例.

没有单独的供应商块的优点是您将能够获得较小的捆绑包大小.小多少取决于您的应用程序.我建议尝试使用带有和不带有标志的构建,以查看是否存在显着差异.

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.

另一方面,启用vendorChunk的主要优点是用户将只能下载更改的客户端代码而无需第三方代码(不太可能经常更改).

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

总结:

在以下情况下,将vendorChunk设置为true:

Set vendorChunk to true if:

  • 您计划经常更新客户端代码,而无需更改许多第三方库.

在以下情况下,将vendorChunk设置为false:

Set vendorChunk to false if:

  • 这样做显着减小了捆束的大小
  • 或者您不太可能经常更改客户端代码

这篇关于我应该在生产中使用vendorChunk吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆