uniapp subcontracting, mini program subcontracting processing, solution for mini program release package that is too large

1. What is subcontracting?

Sub-packaging is to divide a complete small program project into different sub-packages according to needs. When building, package different sub-packages and load them on demand.

2. Benefits of subcontracting

1. Can reduce the download time for the first launch of the mini program

2. Better decoupling collaboration in multi-person development

3. The size of the main package for mini program release is too large

3. Limitation on subcontracting volume

1. For the entire mini program, the main package plus sub-packages cannot exceed 20M, and a single package cannot exceed 2M. The same is true for the main package.

4. Subcontracting configuration steps

1. First create a sub-package under the pages file. You can create multiple sub-packages with any sub-package name.

2. After creating the subpackage, the subpackage directory structure is the same as the main package.

 3. Configure subpackages for subpackage loading in the pages.json file: [{},{},....], multiple subpackages can be configured in subPackages, root: ' ' The root directory of the subpackage is in the pages file The name of the newly added subcontract package inside 

 

Precautions:

  1. Subpackage size cannot exceed 4MB.

  2. Subpackage paths cannot contain paths that already exist in the main package.

  3. The wxs file of the sub-packaged main page can only reference the js files in the sub-package, not the js files in the main package.

  4. Components in sub-packages cannot be referenced by pages in the main package and vice versa.

  5. Pages and components in sub-packages cannot use custom components in the main package.

Guess you like

Origin blog.csdn.net/weixin_65478269/article/details/131205831