简体   繁体   English

块供应商文件在生产中太大

[英]Chunk-vendors files is too big on production

After production build my vue.js app, i saw that my chunk-vendors files are too big and this have an impact on web performance, screen below:在生产构建我的 vue.js 应用程序后,我发现我的块供应商文件太大,这对 web 性能有影响,屏幕如下:

在此处输入图像描述

how to reduce size of this files?如何减小此文件的大小?

I try to import component in my router.js via lazy loading but not help here, what is another solution to this problem?我尝试通过延迟加载在我的 router.js 中导入组件但在这里没有帮助,这个问题的另一种解决方案是什么?

thanks for any help!谢谢你的帮助!

Further to the previous comments, you likely need to analyse what is being imported into your app.除了前面的评论,您可能需要分析导入到您的应用程序中的内容。

A good way to do this is through a dependency analysis.执行此操作的一个好方法是通过依赖性分析。 If you're using vue-cli, you can add Webpack Bundle Analysis to your devDependencies.如果您使用的是 vue-cli,则可以将Webpack Bundle Analysis添加到您的 devDependencies。 This will allow you to see what is being imported.这将允许您查看正在导入的内容。

Pay special attention to things like icon libraries (like @mdi) and other helper libraries like @vueuse or lodash.特别注意图标库(如@mdi)和其他辅助库(如@vueuse 或 lodash)。 If they're imported incorrectly, you can end up with the entire package rather than treeshaking out only the ones used.如果它们导入不正确,您最终可能会得到整个 package,而不是仅使用 treeshaking。

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

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