当前位置:网站首页>Small program -- subcontracting
Small program -- subcontracting
2022-08-01 21:36:00 【like Feynman %】
1. What is subcontracting
Subcontracting refers to dividing a complete applet project into different according to requirementsSubpackages, which are packaged into different subpackages during construction, and users can load on demand
when they use them.2. The benefits of subcontracting
- You can optimize the download time for the first launch of the applet
- Better decoupling and collaboration
3. Composition of the project before subcontracting
Before subcontracting, all pages and resources in the applet project arePackaged together, resulting in the entire project is too large, affecting the download time of the applet first startup

4. The composition of the project after subcontracting
After subcontracting, it mainly consists of 1 main package + multiple subcontracts:
- Generally only contains the startup page or TabBar page of the project, and all subcontractsSome public resources needed
- Subpackage: Only include pages and private resources related to the current subpackage

5. Subpackage loading rules
When the applet starts, by default it will download the main package and start the page in the main packagespan>
The tabBar page needs to be placed in the main package
When the user enters a page in the subpackage, client will download the corresponding subpackage, and display it after the download is complete
Non-tabBar pages can be divided into different subpackages according to different functions, and then downloaded on demand
6. The volume limit of subcontracting
Currently, there are two restrictions on the size of sub-packages of Mini Programs:
- The size of all sub-packages of this applet project does not exceed 16M (main package + all sub-packages)
- Single subpackage/main package size cannot exceed 2M
7. Use subcontracting

"subpackages": [{"root": "packageA","name": "p1",//Name the package"pages": ["pages/cat","pages/dog"]},{"root": "packageB","name": "p2","pages": ["pages/apple","pages/banana"]}],8. How to check the volume of the package

9. Packaging principles
- The applet will be subpackaged according to the configuration of subpackages, and the directories other than subpackages will be packagedinto the main package
- The main package can also have its own pages (ie the outermost pages field)
- tabBar page must be in main package
- Subpackages cannot be nested with each other
10. Citation principles
- Main packageCannot referenceprivate resources in subpackages
- cannot refer to each other between subcontractsprivate resources
- Subcontractingcan referencepublic resources in the main package
边栏推荐
- 关于npm的那些事儿
- 365天挑战LeetCode1000题——Day 046 生成每种字符都是奇数个的字符串 + 两数相加 + 有效的括号
- 2022-08-01 第五小组 顾祥全 学习笔记 day25-枚举与泛型
- C Pitfalls and Defects Chapter 7 Portability Defects 7.6 Memory Location 0
- pytest:开始使用
- 基于php湘西旅游网站管理系统获取(php毕业设计)
- LeetCode·每日一题·1374.生成每种字符都是奇数个的字符串·模拟
- Uses of Anacoda
- C Expert Programming Chapter 1 C: Through the Fog of Time and Space 1.3 The Standard I/O Library and the C Preprocessor
- sizeof的详细解说和与strlen的区别
猜你喜欢
随机推荐
MySQL相关知识
How to encapsulate the cookie/localStorage sessionStorage hook?
ImportError: `save_weights` requires h5py.问题解决
基于php酒店在线预定管理系统获取(php毕业设计)
XSS漏洞
JSD-2204-Knife4j框架-处理响应结果-Day07
C Pitfalls and Defects Chapter 7 Portability Defects 7.7 Truncation During Division
Appendix A printf, varargs and stdarg a. 2 use varargs. H to realize the variable argument list
Spark shuffle调优
How to choose Visibility, Display, and Opacity when interacting or animating
P7215 [JOISC2020] 首都 题解
Spark cluster construction
Day33 LeetCode
位运算简介
scikit-learn no moudule named six
牛血清白蛋白刺槐豆胶壳聚糖缓释纳米微球/多西紫杉醇的纳米微球DTX-DHA-BSA-NPs
方舟:生存进化PVE模式和PVP模式
Get started with Grafana in 15 minutes
JS Improvement: Handwritten Publish Subscriber Model (Xiaobai)
C Expert Programming Chapter 1 C: Through the Fog of Time and Space 1.4 K&R C









