Skip to main content

Project Configuration File

You can use the project.config.json file in the project root directory to configure the project.

Configuration Items#

PropertyTypeDefault ValueRequiredDescription
miniprogramRootString-โœ“Specifies the directory (a relative path) of the Mini Program source code
packOptionsObject--Package configuration options

packOptions#

packOptions is used to configure the options of project packaging. Packaging is a necessary step for previewing and uploading a project.

You can use the packOptions.ignore field to specify the filter rules. The files or folders that match the rules will be ignored when the project is packaged, and they will not appear in the preview or upload results.

packOptions.ignore is an array of objects with the following element types:

PropertyTypeDefault ValueRequiredDescription
valueStringโœ“โœ“Path or value
typeStringโœ“โœ“Type

Available values of type include folder, file, suffix, prefix, regexp, and glob, respectively corresponding to folders, files, suffixes, prefixes, regular expressions, and Glob rules. All values are case-insensitive.

Note: If the value of the value field indicates a file or folder path, the root directory is the Mini Program directory (miniprogramRoot).

Below is a configuration example.

// project.config.json
{  "miniprogramRoot": "./dist",  "packOptions": {    "ignore": [      {        "type": "file",        "value": "utils.bxs"      },      {        "type": "folder",        "value": "image"      },      {        "type": "suffix",        "value": ".LICENSE.txt"      },      {        "type": "suffix",        "value": ".css"      },      {        "type": "prefix",        "value": "rich-"      },      {        "type": "glob",        "value": "pages/API/**/*.js"      },      {        "type": "regexp",        "value": "index\\.js$"      }    ]  }  // ...}