In some cases, the developer needs to divide a Mini Program into different child packages, and package these child packages into different subpackages while building, so that users can load them as needed.
When building a subpackage project, one or more subpackages will be output. Each subpackaged Mini Program must contain a main package that includes the default startup/TabBar page and some common resources and JS scripts required by all subpackages. The sub-packages are divided according to the developer's configuration.
When the Mini Program starts, the main package is downloaded and the pages in the main package are started by default. When a user enters a page in a subpackage, the client downloads the corresponding subpackage and displays it after the download is completed.
Restrictions on subpackage size:
- The total size of all subpackages of a Mini Program cannot exceed 12 MB.
- A single subpackage or main package cannot exceed 2 MB.
Subpacking a Mini Program can improve the download time when the Mini Program is started for the first time and makes it easier for multiple teams to collaborate in development.
For detailed instructions, refer to: