当前位置:网站首页>小程序:uniapp解决 vendor.js 体积过大的问题
小程序:uniapp解决 vendor.js 体积过大的问题
2022-06-26 14:51:00 【[email protected]】
一、环境介绍
uniapp + HBuilderX
二、问题描述
真机调试,提示包提交过大,不能生成二维码,后续上传代码更是不可能了

三、代码包体积优化
3.1、图片等静态资源放到服务器上,小程序引用服务器文件地址(图片较多的话会节约大量的体积)。
项目仅保留了底部导航的icon。
3.2、根据业务类型进行分包处理(分包后单一包的体积迅速减少):
"optimization":{
"subPackages":true
}3.3、运行时压缩代码 (体积减少很多,测试项目减少400多kb)

压缩前:

这几步骤下来代码体积到了:

小于2M,代码已经可以生成二维码预览、调试、上传了
3.4、勾选这几项:

3.5、勾选后这里就通过了:
manifest.json配置按需注入:
"lazyCodeLoading": "requiredComponents"配置后这里通过了

3.6、重要的一点,及时清理无用的代码
四、欢迎交流指正,关注我,一起学习
五、参考链接:
解决 vendor.js 过大的问题_吕小仙的霸霸的博客-CSDN博客_vendor.js过大
Vue 打包优化方案(解决 vendor.js 过大的问题)_黄河爱浪的博客-CSDN博客_vendor.js
Vue 打包优化方案(解决 vendor.js 过大的问题)_黄河爱浪的博客-CSDN博客_vendor.js
https://www.jb51.net/article/164542.htm
uni-app项目vendor.js 过大的处理方式 - 简书
uniapp小程序如何分包?完整详细步骤教给你_沐卿゚的博客-CSDN博客_uniapp分包
如何解决uni-app编译后 vendor.js 文件过大 / 张生荣
uniapp 小程序启用组件按需注入 “lazyCodeLoading“: “requiredComponents“_一斤代码的博客-CSDN博客
版权声明
本文为[[email protected]]所创,转载请带上原文链接,感谢
https://blog.csdn.net/snowball_li/article/details/125440987
边栏推荐
- 一个快速切换一个底层实现的思路分享
- vue中缓存页面 keepAlive使用
- Pod scheduling of kubernetes
- 挖财注册开户安全吗,有没有什么风险?
- Mark一下 Unity3d在Inspector中选中不了资源即Project锁定问题
- 设计人员拿到的工程坐标系等高线CAD图如何加载进图新地球
- Halcon C# 设置窗体字体,自适应显示图片
- RestCloud ETL与Kettle对比分析
- Bank of Beijing x Huawei: network intelligent operation and maintenance tamps the base of digital transformation service
- Is it safe to open an account by digging money? Is there any risk?
猜你喜欢

【 Native cloud】 Éditeur ivx Programmable par tout le monde

ETL过程中数据精度不准确问题

About selenium common. exceptions. Webdriverexception: message: an unknown server side error solution (resolved)

teamviewer显示设备数量上限解决方法

MySQL master-slave replication and read-write separation

一篇抄十篇,CVPR Oral被指大量抄袭,大会最后一天曝光!

文献1

使用 Abp.Zero 搭建第三方登录模块(一):原理篇

使用 Abp.Zero 搭建第三方登录模块(二):服务端开发

Deploy the flask environment using the pagoda panel
随机推荐
R语言epiDisplay包的tableStack函数制作统计汇总表格(分组的描述性统计、假设检验等)、不设置by参数计算基础描述性统计信息、指定对于大多数样本负相关的变量进行反序
使用 Abp.Zero 搭建第三方登录模块(一):原理篇
Excel-vba quick start (II. Condition judgment and circulation)
qt下多个子控件信号槽绑定方法
R语言dplyr包bind_rows函数把两个dataframe数据的行纵向(竖直)合并起来、最终行数为原来两个dataframe行数的加和(Combine Data Frames)
RestCloud ETL抽取动态库表数据实践
Halcon C # sets the form font and adaptively displays pictures
Keil4打开单片机工程一片空白,cpu100%程序卡死的问题解决
信息学奥赛一本通 1405:质数的和与积 (思维题)
Naacl2022: (code practice) good visual guidance promotes better feature extraction, multimodal named entity recognition (with source code download)
ETL过程中数据精度不准确问题
编译配置in文件
It's natural for the landlord to take the rent to repay the mortgage
R语言dplyr包intersect函数获取在两个dataframe中都存在的数据行、获取两个dataframe交叉的数据行
Redis cluster messages
Cluster addslots establish a cluster
Is it safe for flush to register and open an account? Is there any risk?
Is it safe to open a stock account with the account manager online??
Redis事务与watch指令
【 Native cloud】 Éditeur ivx Programmable par tout le monde