# Subcontract loading

WeChat Client 6.6.0, Base Library 1.7.3 The above version is supported. Developer Tools Please use 1.01.1712150 And above version, mayClick here to download

In some cases, the developer needs to divide the Mini Program into different subpackages, packaged into different subpackages at build time, and loaded by the user on demand as they use it.

When you build a Mini Program subcontract project, the build outputs one or more sub-packages. Each subcontract Mini Program must contain aMaster packageThe so-called master package, which places the default launch page/TabBar Pages, and some of the public resources that all sub-packages require/JS Scriptandto subcontractIt is divided according to the developer's configuration.

When the Mini Program is started, the main package will be downloaded by default and the main package page will be launched. When the user enters a page in the subcontract, the client will download the corresponding subcontract, and then display it after the download is completed.

At present, the subcontract size of the Mini Program has the following limitations:

  • The entire Mini Program. All sub-packages are not larger in size than 30M (Mini programs developed by the service provider do not exceed 20M)
  • Single subcontract/The primary package size cannot exceed 2M

Subcontracting the Mini Program can optimize the download time of the Mini Program for the first time, and can better decouple and collaborate when multiple teams develop together.

Please refer to the specific method of use: