Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the problem that the vendor.js file is too large after uni-app compilation

2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "how to solve the problem that the vendor.js file is too large after uni-app compilation". The explanation in this article is simple and clear, easy to learn and understand. Please follow the idea of Xiaobian and go deep into it slowly to study and learn "how to solve the problem that the vendor.js file is too large after uni-app compilation" together!

uni-app compiled vendor.js file too large foreground

Weixin Mini Programs (Mini) developed with uni-app, tool prompt vendor.js is too large when released, es6 to es5 conversion has been skipped. After checking it, I found that common/vendor.js in the compiled code has exceeded 500k, so volume control is needed.

HBuilderX created items check Run-> Run to Mini programs Simulator-> Do you compress code when running

For projects created with cli, you can add the parameter-minimize in pacakge.json, for example: "dev:mp-weixin": "cross-env NODE_ENV=development UNI_PLATFORM=mp-weixin vue-cli-service uni-build --watch --minimize"

Found after running

The vendor.js file was reduced to over 200 k.

Mini programs subcontracting vendor or too large

After using subcontracting, you will find a strange problem. The components and js files of the child package will be packaged into the vendor.js file of the main package, which will cause the vendor.js to be too large and cause the main package to exceed 2M.

Open manifest.json-> source view-> mp-weixin node

Add the following code "optimization": { "subPackages": true}

You will find that the js file of the subcontract will no longer be packaged into the vendor.js of the main package, and the pro-test will work.

Thank you for reading, the above is "uni-app compiled vendor.js file is too large how to solve" the content, after the study of this article, I believe that we have a deeper understanding of uni-app compiled vendor.js file is too large how to solve this problem, the specific use of the situation also needs to be verified by practice. Here is, Xiaobian will push more articles related to knowledge points for everyone, welcome to pay attention!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report