目录

Package Splitting

Assume that the file structure in the root directory is as follows:

|— ascf.config.json
|— app.json
|— app.js
|— app.css
|— components
|  |— cart.json
|  |— cart.hxml
|  |— cart.js
|  |— cart.css
|— pages
|  |— user
|  |  |— user.json
|  |  |— user.hxml
|  |  |— user.js
|  |  |— user.css
|— pkgA
|  |— pageA1
|  |  |— user.json
|  |  |— user.hxml
|  |  |— user.js
|  |  |— user.css

Declare the project's subpackage structure using the subpackages field in app.json:

"subpackages": [
  {
    "root": "pkgA",
    "pages": [
     "pageA1/user"
    ]
  }
],

Rules for converting a mini program into an atomic service:

  1. Copy the root field from the app.json file and rename resource to the underscore format for naming subpackages.
  2. In the rawfile of each subpackage, retain the directory structure in root.

Packaging Principle