当前位置:网站首页>uniapp小程序分包
uniapp小程序分包
2022-07-04 06:41:00 【天使的同类】
uniapp小程序分包
分包原因:由于微信小程序包总体积不能超过2M,这时就需要把代码进行分包处理。
主包:即放置默认启动页面/TabBar 页面,以及一些所有分包都需用到公共资源/JS 脚本;而分包则是根据pages.json的配置进行划分。
分包后的每个分包的大小是2M以内,总体积一共不能超过20M。
subPackages:分包加载配置,此配置为小程序的分包加载机制,详细请参考uniapp官网分包机制
项目目录结构如下:
需要在 pages.json 中进行代码分包处理:
{
"pages": [{
"path": "pages/index/index",
"style": {
...} //页面配置
}],
"subPackages": [{
"root": "pagesA",
"pages": [{
"path": "punchCard/index",
"style": {
...}
}]
}, {
"root": "pagesB",
"pages": [{
"path": "collectInfo/index",
"style": {
...}
}]
} //后面继续增加其他分包
],
"preloadRule": {
//分包预载配置
"pagesA/index/index": {
"network": "all",
"packages": ["__APP__"]
},
"pagesB/punchCard/index": {
"network": "all",
"packages": ["pagesA"]
}
}
}
preloadRule:配置preloadRule后,在进入小程序某个页面时,由框架自动预下载可能需要的分包,提升进入后续分包页面时的启动速度,具体请参考uniapp官网分包预载配置
There is no fate but what we make for ourselves。
边栏推荐
- The sorting in C language realizes the number sorting method from small to large
- Variables d'environnement personnalisées uniapp
- 颈椎、脚气
- Wechat applet scroll view component scrollable view area
- SQL join, left join, right join usage
- Cervical vertebra, beriberi
- P26-P34 third_ template
- 期末周,我裂开
- 金盾视频播放器拦截的软件关键词和进程信息
- STM32 单片机ADC 电压计算
猜你喜欢
图的底部问题
Another company raised the price of SAIC Roewe new energy products from March 1
Abap:ooalv realizes the function of adding, deleting, modifying and checking
ORICO ORICO outdoor power experience, lightweight and portable, the most convenient office charging station
树形dp
C language - Blue Bridge Cup - Snake filling
C réaliser des jeux de serpents gourmands
Native Cloud - SSH articles must be read on Cloud (used for Remote Login to Cloud Server)
2022 Xinjiang's latest eight members (Safety Officer) simulated examination questions and answers
R statistical mapping - random forest classification analysis and species abundance difference test combination diagram
随机推荐
Stc8h development (XII): I2C drive AT24C08, at24c32 series EEPROM storage
2022 Xinjiang's latest eight members (Safety Officer) simulated examination questions and answers
tars源码分析之5
MySQL 45 lecture learning notes (VI) global lock
C语言中的排序,实现从小到大的数字排序法
Appium foundation - appium installation (II)
【问题记录】03 连接MySQL数据库提示:1040 Too many connections
Analysis of tars source code 1
tars源码分析之6
selenium IDE插件下载安装使用教程
Data analysis notes 09
Mysql 45讲学习笔记(十二)MySQL会“抖”一下
Modify TCP timestamp to optimize transmission performance
Tar source code analysis Part 3
1、 Relevant theories and tools of network security penetration testing
Appium基础 — APPium安装(二)
《ClickHouse原理解析与应用实践》读书笔记(4)
金盾视频播放器拦截的软件关键词和进程信息
请问旧版的的常用SQL怎么迁移到新版本里来?
Redis interview question set