Skip to content

Project Configuration

The project.config.json file in the project root directory can configure the project.

The project.config.json file is mainly used to configure the behavior and features of the mini program development tool in the mini program. This file allows developers to adjust some default settings of the development tool to better adapt to the development process and environment.

Configuration item

PropertiesTypeDescription
miniprogramRootPath StringSpecify the directory of the mini program source code (must be a relative path).
compileTypeStringCompilation type, the default value is miniprogram.
TCMPPappidStringProject appid
projectnameStringProject name
settingObjectProject settings
libVersionStringBase library version
conditionObjectConditional compilation configuration
mockConfigObjectIDE mockAPI configuration

miniprogramRoot

Mini program source code directory (must be a relative path)

js
{
  "miniprogramRoot": "./src"
}

compileType

Compilation type, the default value is miniprogram

js
{
  "compileType": "miniprogram"
}

TCMPPappid

The corresponding appId of the mini program on the Luffa Cloud console.

js
{
  "TCMPPappid": "mpz5g4hpzd5p3k2l"
}

projectname

Project name.

js
{
  "projectname": "main-demo"
}

setting

Project compilation settings, you can specify the following settings.

The following fields can be matched in Developer Tools > Details > Local Settings.

Field NameTypeDescription
es6BooleanWhether to enable es6 to es9
postcssBooleanWhether to automatically complete the style when uploading code
minifiedBooleanWhether to automatically compress the script file when uploading code
uglifyFileNameBooleanProtect the code when uploading
urlCheckBooleanWhether to check the secure domain name and TLS version and HTTPS certificate

libVersion

The version number of the basic library currently used.

js
{
  "libVersion": "1.5.0"
}

condition

Corresponds to the conditional compilation information set on the IDE.

js
{
  "condition": {
    "miniprogram": {
      "current": 0,
      "list": [
        {
          "id": 0,
          "name": "tab3",
          "pathName": "page/extend/index",
          "query": "",
          "scene": null
        },
        {
          "id": -1,
          "name": "tab4",
          "pathName": "page/extend/index",
          "query": "name=1",
          "scene": null
        }
      ]
    }
  }
}

mockConfig

js
{
  "globalOpen": true,
  "rules": [
    {
      "ruleName": "testApi",
      "ruleId": "48b83a70-84fd-400d-b53d-097518cfa515",
      "apiName": "invokeNativePlugin",
      "enable": true,
      "mockType": "API",
      "returnType": "succ",
      "resStr": "{\n\"name\": 1,\n\"cvv\": 2,\n\"ccdd\": \"c223344\"\n}",
      "filterList": [
        {
          "propName": "api_name",
          "propRegString": "testApi",
          "matchType": "string"
        },
        {
          "propName": "",
          "propRegString": "",
          "matchType": "string"
        }
      ],
      "verifyFail": false
    }
  ]
}