简体   繁体   English

vue-cli-service 构建比 vue ui 构建更重

[英]vue-cli-service build heavier than vue ui build

I build my VueJS app with vue-cli-service build --mode production , and my chunk-vendors.js weighs 3.2M.我使用vue-cli-service build --mode production --mode production 构建我的 VueJS 应用程序,我的 chunk-vendors.js 重 3.2M。 So I decided to investigate why it's so heavy, using vue ui .所以我决定使用vue ui调查为什么它这么重。 Then, I simply click on Build, and I see that chunk-vendors.js is now 1.0M !然后,我只需单击“构建”,我就会看到chunk-vendors.js现在是 1.0M!

Why is there a such difference between these two build?为什么这两个构建之间存在这样的差异?

Here the screenshots:这里的截图:

在此处输入图像描述 在此处输入图像描述

Thank you for you help!谢谢你的帮助!

vue ui 's build command is this: vue uibuild命令是这样的:

vue-cli-service build --mode production --target app --no-module --dashboard

Notice the --no-module flag, which turns off modern browser builds , which is enabled by default as of Vue CLI 5.0.0 .注意--no-module标志,它关闭现代浏览器构建从 Vue CLI 5.0.0 开始默认启用 Therefore, the command you're using (ie, without --no-module ) creates a modern build, which includes transpiled code and polyfilled bundles for legacy browsers in addition to slimmer code for modern browsers that don't require the polyfills.因此,您正在使用的命令(即,没有--no-module )创建了一个现代构建,其中包括用于旧版浏览器的转译代码和 polyfill 包,以及用于不需要 polyfill 的现代浏览器的精简代码。 On the other hand, vue ui only builds the latter.另一方面, vue ui只构建后者。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM