当前位置:网站首页>小程序: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
边栏推荐
- View touch analysis
- Halcon C# 设置窗体字体,自适应显示图片
- Unity C# 网络学习(八)——WWW
- R语言dplyr包bind_rows函数把两个dataframe数据的行纵向(竖直)合并起来、最终行数为原来两个dataframe行数的加和(Combine Data Frames)
- One copy ten, CVPR oral was accused of plagiarizing a lot, and it was exposed on the last day of the conference!
- Unity 利用Skybox Panoramic着色器制作全景图预览有条缝隙问题解决办法
- 权威发布 | 延安大学2022年教师岗位招聘公告
- Excerpt from three body
- Notes on writing questions in C language -- table tennis competition
- Authoritative announcement on the recruitment of teachers in Yan'an University in 2022
猜你喜欢

Redis-集群

TCP congestion control details | 1 summary

Attention meets Geometry:几何引导的时空注意一致性自监督单目深度估计

印尼投资部长:鸿海考虑在其新首都建立电动公交系统、城市物联网

JVM 输出 GC 日志导致 JVM 卡住,我 TM 人傻了

710. random numbers in the blacklist

重磅白皮书发布,华为持续引领未来智慧园区建设新模式

Keil4打开单片机工程一片空白,cpu100%程序卡死的问题解决

Unity uses skybox panoramic shader to make panorama preview. There is a gap. Solution

Authoritative announcement on the recruitment of teachers in Yan'an University in 2022
随机推荐
Is it safe to open an account by digging money? Is there any risk?
710. 黑名单中的随机数
TCP 复位攻击原理
Use abp Zero builds a third-party login module (I): Principles
【soloπ】adb连接单个多个手机
C语言刷题随记 —— 乒乓球比赛
Kubernetes的pod
15 BS object Node name Node name String get nested node content
聊聊几位大厂清华同学的近况
NVIDIA SMI error
Go变量的声明与赋值
How to mount cloud disks in ECS
Login authentication service
The engine "node" is inconsistent with this module
This is the graceful file system mounting method, which is effective through personal testing
Redis-集群
手机股票注册开户安全吗,有没有什么风险?
杜老师说网站更新图解
Detailed explanation of C language programming problem: can any three sides form a triangle, output the area of the triangle and judge its type
聊聊 RPA 方向的规划:简单有价值的事情长期坚持做