# Project configuration file
project.config.jsonand [in the project root directoryproject.private.config.json`files can configure projects,The same settings in project.private.config.jsonare superior toproject.config.json- The public configuration can be configured in the
project.config.jsonfile, in theproject.private.config.jsonConfigure a personal configuration that allows theproject.private-config.json [[TAG2-END]].gitignore`Avoid versioning conflicts. Fields in project.private.config.jsonare overwritten by changes in the developer tools.project.private.config.jsonAs inproject.private.config.jsonHaveAppIDfield, then modify appid in Details - Basic Information to writeproject.private.config.jsonWill not overwrite the contents of theproject.config.json``appidfield- Development-related settings are synchronized to
project.private.config.jsonBut settings related to the final compilation product cannot be found inproject.private.config.jsonChanges in the interface will not be synchronized to theproject.private.config.jsonfile.See table Whether private settings are allowed.
# Level 1 field
You can configure the project using the project.config.jsonfile in the project root directory.
| Field Name | type | Introductions |
|---|---|---|
| miniprogramRoot | Path String | Specify the directory of Weixin Mini Program source code (relative path required) |
| qcloudRoot | Path String | Specify the directory of Tencent Cloud projects (must be relative paths) |
| pluginRoot | Path String | Specify the directory of the plug-in project (preferably a relative path) |
| cloudbaseRoot | Path String | Cloud development code root directory (relative path) |
| cloudfunctionRoot | Path String | Cloud function code root directory (relative path) |
| cloudfunctionTemplateRoot | Path String | The root directory of the cloud function local debugging request template (relative path required) |
| cloudcontainerRoot | Path String | Cloud managed code root directory (relative path required) |
| compileType | String | Compilation Type |
| setting | Object | Project setup |
| libVersion | String | Base library version |
| appid | String | AppID of the project |
| projectname | String | Project Name |
| packOptions | Object | Package configuration options |
| debugOptions | Object | Debugging configuration options |
| watchOptions | Object | File listening configuration settings |
| scripts | Object | Custom Pre-processing |
| staticServerOptions | Object | Valid only in the MiniGame project |
| editorSetting | Object | Specifies the tabIndent and tabSize of the automatically generated file |
| skeletonConfig | Object | Skeleton screen related settings |
# compileType
The compilation type acts on the following settings of the development tool
Valid values
| name | Introductions |
|---|---|
| miniprogram | Currently a normal Weixin Mini Program project |
| plugin | Currently a Weixin Mini Program plug-in project |
# setting
For the compilation settings of your project, you can specify the following settings.Some settings could not take effect inproject.private.config.json
The following fields can be developed by Developer Tools - Details - Local settings can correspond above

| Field Name | type | Allow private settings [1] | Introductions |
|---|---|---|---|
| condition | Boolean | no | Enable conditional compilation |
| es6 | Boolean | no | Whether to enable es6 to es5 [2] |
| enhance | Boolean | no | Whether to turn on enhanced compilation [2] |
| postcss | Boolean | no | Does the styles are automatically filled out when the code is uploaded |
| minified | Boolean | no | Does the script file be automatically compressed when you upload the code? |
| minifyWXSS | Boolean | no | Does the style file be automatically compressed when you upload the code? |
| minifyWXML | Boolean | no | Whether to automatically compress the WXML file when uploading code |
| swc | Boolean | no | Turn on swc compilation mode |
| uglifyFileName | Boolean | no | Code protection when uploading |
| ignoreUploadUnusedFiles | Boolean | no | Whether to filter unreliable files when uploading |
| autoAudits | Boolean | yes | Do you automatically run the experience score? |
| urlCheck | Boolean | yes | Check the secure domain name and TLS version |
| compileHotReLoad | Boolean | yes | Whether to turn on automatic heat reload after file saving |
| preloadBackgroundData | Boolean | yes | Weixin Mini Program Is data prepulled when loading |
| lazyloadPlaceholderEnable | Boolean | yes | Whether to enable lazy injection placeholder debugging [3] |
| useStaticServer | Boolean | yes | Only valid for the MiniGame project, whether to turn on the static resource server [4] |
| bigPackageSizeSupport | Boolean | yes | Previewing and commissioning of the main package, sub-package volume upper limit adjusted to 4 M (Weixin Mini Program), 8 M (MiniGame) |
| skylineRenderEnable | Boolean | yes | Whether to turn on skyline rendering debugging |
The following fields are implicit settings for the developer tools
| Field Name | type | Allow private settings [1] | Introductions |
|---|---|---|---|
| babelSetting | Object | no | Enhanced Configuration of Babel under Compilation |
| minifyWXMLSetting | Object | no | Compressing wxml configuration items |
| useCompilerPlugins | String [] or false | no | Compile plug-in configuration |
| disableUseStrict | Boolean | no | Do you disable strict mode when compiling JS to ES5 |
| uploadWithSourceMap | Boolean | no | Whether to upload with sourcemap (default is true) |
| localPlugins | Boolean | no | In the MiniGame plug-in project, whether to enable "Source plug-in resources from local directories" [5] Characteristics |
| packNpmManually | Boolean | no | Whether to manually configure the path to build npm |
| packNpmRelationList | Array | no | Effective only whenpackNpmManuallyis true, for details refer to Build npm documentation |
| coverView | Boolean | yes | Whether to use tools to render CoverView |
| ignoreDevUnusedFiles | Boolean | yes | Whether to filter dependence-free files during the development stages such as preview, live debugging, and local emulators (defaults to true) |
| ignoreCodeQuality | Boolean | yes | Preview, real machine debugging upload and other development stages whether not to perform code quality testing (default is false) |
| checkInvalidKey | Boolean | yes | Whether to display JSON file validation error message |
| showShadowRootInWxmlPanel | Boolean | yes | Whether to turn on the debugger WXML panel display shadow-root |
| useIsolateContext | Boolean | yes | Whether to turn on Weixin Mini Program Independent Domain Debugging [6] |
| useMultiFrameRuntime | Boolean | yes | Whether to turn on some resources that the emulator preloads Weixin Mini Program[7] 。This setting to false causesuseIsolateContextto fail |
| useApiHook | Boolean | yes | Whether to enable the API Hook feature [8] |
| useApiHostProcess | Boolean | yes | Whether to process some Weixin Mini Program API in additional processes[9] |
| useLanDebug | Boolean | yes | Valid only on MiniGame, whether to turn on the local network debug server |
| enableEngineNative | Boolean | yes | Whether to turn on the low-level acceleration feature that supports referencing node native modules in a game engine project |
| showES6CompileOption | Boolean | yes | Whether to display the traditional ES6 to ES5 switch (for es6) and the enhanced build switch (for enhance) in the local settings |
Note 1 : Development-related changes to theproject.private.config.jsonHowever, the settings associated with the final build product do not take effect inproject.private.config.json, and changes in the interface do not synchronize toproject.private.config.json
Note 2 :es6Andenhanceneed to be both true / false, corresponding tocompiling JS to ES5
Note 3 : ( Lazy Injection Placeholder Debugging ) Turn on On Demand InjectionAfter the corresponding tick option appears in the project settings panel. When turned on, the component injected on demand stops injecting, and the page stops in the occupied component state, making it easy to debug custom occupied components.
Note 4 : ( Static Resource Server can host static resources that are local to the project and is mainly used to test the effect of loading of real resources at preview time.
Note 5 : ( Use local directories as source of plug-in resources ]] When this feature is enabled, the tool stops obtaining the MiniGame plug-in package contents from online and checks the file integrity of the local corresponding directories.It is only valid for small game plugin projects. To use the local disk directory as a source of resources for the plug-in, you need to configure the relevant properties in the game.json of the mini-game plug-in project at the same time.
Note 6 : ( Weixin Mini ProgramStand-alone debugging ) A new way of executing code inside an Mini Program that affects only tool-side debugging.The future will replace traditional execution methods and become the default choice. Valid only in repositories 2.11.1 and above. Turning this feature off may help to avoid some unknown errors encountered in debugging.
Note 7 : ( Pre-load some resources Weixin Mini Program ) With this built-in feature turned on, the reload of Mini Programs during debugging may be faster.This setting does not affect the real machine and actual operation.
NOTE 8 : ( API Hook Function ) Turning off this internal feature may cause some debugging features of the tool (such as mock) to fail. This setting does not affect real-world operation.
Note 9 : ( Additional processes ) When this internal feature is turned on, some API calls are moved to a separate process to reduce the burden on the tool's main process. This setting does not affect real-world operation.
# useCompilerPlugins
Compiler plug-in configuration, currently support compiler plug-in typescript, less, sass
Such as
{
"setting": {
"useCompilerPlugins": [
"typescript",
"less"
]
}
}
Express project support directly using typescript and less
# babelSetting
A configuration item for Babel when compiling JS to ES5, where the following settings can be specified
| Field Name | type | Introductions |
|---|---|---|
| outputPath | String | The output directory of the Babel helper function, which defaults to@ babel / runtime |
| ignore | Array`` | Configure files or directories that need to skip Babel compilation (including code compression) processing |
Note 1 : In addition to specifying a file path, you can also specify a directory, as shown in the following project configuration example
# minifyWXMLSetting
Configuration item when compressing wxml, minifyWXMLSetting.global is global setting, minifyWXMLSetting [pagePath.wxml]Is the specific page wxml into effect configuration, and minifyWXMLSetting.global global settings will be merged into effect, set the following:
| Field Name | type | Introductions |
|---|---|---|
| collapseWhitespace | Boolean | Default true, all consecutive whitespace in the label will be compressed to 1 space, the case of newline by preserveLineBreaks |
| conservativeCollapse | Boolean | Default false: no spaces are left before and after the label; True: But a space will be left before and after the tag (sometimes) |
| preserveLineBreaks | Boolean | Default false: Press collapseWhitespace, true all newlines are preserved |
Like the code:
<view>
a a
a a
</view>
By default it will be compressed to
<view>a a a a</view>
If set up:
{
"setting": {
"minifyWXMLSetting": {
"global": {
"collapseWhitespace": true,
"conservativeCollapse": false,
"preserveLineBreaks": true,
}
}
}
}
This is compressed to:
<view>
a a
a a
</view>
If set up:
{
"setting": {
"minifyWXMLSetting": {
"global": {
"collapseWhitespace": true,
"conservativeCollapse": true,
"preserveLineBreaks": false,
}
}
}
}
This is compressed to:
<view> a a a a </view>
Note 1 :textAll line breaks and whitespace characters in the "`" tag are reserved
# libVersion
You can specify the specific version number of the base library that the project runs on
project.config.json``libVersioncan specify the following values
| value | Introductions |
|---|---|
| latest | The latest base library in non-grayscale |
| trial | The latest base library |
| widelyUsed | Base libraries with the highest proportion of use |
The above values inproject.private.config.jsonInvalid in the file because manually changing the version of the base library in Developer Tools - Details - Local Settings covers upproject.private.config.json``libVersion
# scripts
Specify commands to customize preprocessing
| name | Introductions |
|---|---|
| beforeCompile | Preprocessing commands before compilation |
| beforePreview | Preprocess commands before preview |
| beforeUpload | Pre-processing commands before upload |
# packOptions
PackOptionsare used to configure options for a project during packaging.Packing is a necessary step to a project when previewing and uploading.
packOptions.includeFields that are used to configure the packaging to require files to be loaded ( within the suffix whitelist only ) or folders, and those files or folders that match will always appear in the preview or upload results.(This field has a higher priority thanpackOptions.ignore)
You can also specify thepackOptions.ignorefield to configure the packaging process to ignore files or folders that meet the specified rules when packaging, and these files or folder will not appear in the results of the preview or upload.
PackOptions.ignoreandpackOptions.includeas an array of objects with the following types of object elements:
| Field Name | type | Introductions |
|---|---|---|
| value | string | Path 1 or value |
| type | string | type |
Where thetypecan take a value offolder、file、suffix、prefix、regexp 2 、glob 2 ,Corresponding to the document folder, file, suffix, prefix, code expression, Glob rules. All rule values automatically ignore uppercase and lowercase.
Note 1 :valueIf the value of the field represents the path to a file or document folder, the value of the Weixin Mini Program directory (miniprogramRoot) Is the root directory.
Note 2 :regexp,globOnly 1.02.1809260 and above tools are supported.
The example configuration is as follows.
{
"packOptions": {
"ignore": [{
"type": "file",
"value": "test/test.js"
}, {
"type": "folder",
"value": "test"
}, {
"type": "suffix",
"value": ".webp"
}, {
"type": "prefix",
"value": "test-"
}, {
"type": "glob",
"value": "test/**/*.js"
}, {
"type": "regexp",
"value": "\\.jsx$"
}]
}
}
Note : Changes to this setting may require reopening the project to take effect.
# debugOptions
DebugoptionsConfigure options when debugging project code.
You can now specify thedebugOptions.hidedInDevtoolsfield to configure the files to hide source code in the debugger Sources panel during debugging.
The configuration rules for hidedInDevtoolsare consistent withpackOptions.ignore.
When a js file complies with this rule, the source body of the file in the debugger Sources panel is hidden and appears as:
// xxx.js has been hided by project.config.json
Note: After you configure this rule, you may need to close and reopen the project to see the effect.
Example of project configuration:
{
"miniprogramRoot": "./src",
"qcloudRoot": "./svr",
"setting": {
"postcss": true,
"es6": true,
"minified": true,
"urlCheck": false,
"checkSiteMap": true,
"enhance": true,
"babelSetting": {
"ignore": [
"utils/something_not_to_process.js",
"miniprogram_npm/*",
"utils/already_handle/*"
]
}
},
"packOptions": {
"ignore": []
},
"debugOptions": {}
}
# watchOptions
WatchOptionsConfigure file-matching rules for displaying and listening for file changes in a project that can be ignored.
Some projects (such as game projects) may have thousands of project files, most of which may be source files.It is not the Weixin Mini Program and MiniGame code that is concerned with the presentation of files, which may not need to be noticed by the developer during the development of the tool,Thus, a tool can add a configuration to ignore specified files and directories, thus not monitoring these files for file traversal acquisition and file content changes, thereby increasing the speed of the tool opening and reducing the memory used by the tool opening.
It is now possible to specify thewatchOptions.ignorefield to configure the tool to ignore files or folders that meet the specified rulesNeglected files will not be displayed in the editor file list and listened toto avoid displaying and listening to unnecessary file contents in the project (these files or folders don't need to care about file changes).
WatchOptions.ignoreforglob patternCharacter string arrays are supported as follows
- Match 0 to more than one character
- ? Match a character
- [...] Match a list of characters, a list similar to regular expressions
- !(pattern|pattern|pattern) Reverse match the pattern inside the parentheses
- ? (pattern | pattern | pattern) Matches 0 or 1 pattern in parentheses
- (pattern | pattern | pattern) Match at least 1 pattern in parentheses
- (pattern | pattern | pattern) matches 0 to multiple patterns within parentheses
- @(pattern|pat*|pat? Ern) to precisely match the pattern within the parentheses
- **Match 0 to multiple subdirectories, recursively match subdirectories
The example configuration is as follows.
As shown below
{
"description": "项目配置文件",
"watchOptions": {
"ignore": [
"utils/util.js",
"libs/**/**"
]
}
}
Note 1 : The values in the watchOptions.ignore array that represent file or folder paths are based on the project root directory. Note 2 : Since both file traversal and watch are executed at project startup, you need to reopen the project if you modify watchOptions Note 3 : This configuration is only supported by tools from 1.02.1910220 and above.