.Currently, subcontracting of mini programs has the following restrictions:
- The size of all subpackages of the entire applet should not exceed 20M
- The size of a single subpackage/main package does not exceed 2M
Original project path:
├── app.js
├── app.json
├── app.wxss
├── packageA
│ └── pages
│ ├── cat
│ └── dog
├── packageB
│ └── pages
│ ├── apple
│ └── banana
├── pages
│ ├── index
│ └── logs
└── utils
Subpackage loading of applets
Subpackage configuration path
├── app.js
├── app.json
├── app.wxss
├── packageA
│ └── pages
│ ├── cat
│ └── dog
├── packageB
│ └── pages
│ ├── apple
│ └── banana
├── pages
│ ├── index
│ └── logs
└── utils
Packaging Principles
- After declaration
subpackages
, it willsubpackages
be packaged according to the configuration path, andsubpackages
directories outside the configuration path will be packaged into the main package - The main package can also have its own pages, the outermost pages field.
subpackage
subpackage
The root directory of a cannot be a subdirectory within anothertabBar
The page must be inside the main package
Citation principle
packageA
JS files cannot be required , but JS files withinpackageB
the main package can be required ; this restriction is not imposed when using subpackage asynchronizationpackageA
packageA
The template cannot be importedpackageB
, butpackageA
the template in the main package can be requiredpackageA
unusablepackageB
resources, but can usepackageA
resources inside the main package,
Low version compatible
The compatibility of the old version of the client is handled by the WeChat background compilation. The background will compile two code packages, one is the code after subcontracting, and the other is the compatible code of the entire package. New clients use subpackages, while old clients still use the whole package. The full package will put subpackage
the paths inside each page into pages.