# manifest.json 应用配置

The manifest.json file is the configuration file of the application, which is used to specify the name, icon, permissions, etc. of the application. The project created by HBuilderX has this file in the root directory, and the project created by CLI has this file in the src directory.

# 配置项列表

Attribute Type Default Description Minimum Version
name String application name
appid String When creating a new uni-app project, the DCloud cloud distribution. Purpose see details Application logo
description String application description
locale String auto Set current default language, refer to locale
versionName String version name, for example: 1.0.0. See the Tips description below for details
versionCode Number 版本号,例如:36
transformPx Boolean true 是否转换项目的px,为true时将px转换为rpx,为false时,px为传统的实际像素。为兼容历史项目默认值为 true。 此选项已废弃,仅部分平台支持,不推荐新项目启用此配置(新建项目模板一般配置为 false)
networkTimeout Object Network timeout, see details
debug Boolean false Whether to enable the debug mode, the debugging information will be given in the form of info after it is enabled, and its information includes page registration, page routing, data update, event triggering, etc.
uniStatistics Object Whether to enable uni statistics, global configuration 2.2.3+
app-plus Object App specific configuration
h5 Object H5 specific configuration
quickapp Object QuickApp specific configuration, will be supported soon
mp-weixin Object WeChat MiniApp specific configuration
mp-alipay Object Alipay MiniApp specific configuration
mp-baidu Object 百度小程序特有配置
mp-toutiao Object 抖音小程序特有配置 1.6.0
mp-lark Object Special configuration of Feishu MiniApp 3.2.12
mp-qq Object qq 小程序特有配置 2.1.0
mp-kuaishou Object 快手小程序特有配置 3.2.2

Tips

  • The appid of uni-app is assigned by DCloud and is mainly used for DCloud-related cloud services. Please do not modify it yourself. See details
  • Pay attention to distinguish the appid of uni-app from the appid assigned by WeChat MiniApp, iOS and other platforms, and the appid of third-party SDKs.
  • versionName will be used when cloud packaging App and generating wgt application resources. If you need to upgrade the App version, first modify here and then cloud package. This version will also be used as the basis for exporting wgt resources for offline packaging and hot updates.
  • When packaging locally and hot updating, the App version and the wgt application resource version will no longer be consistent. At this time, the App version can be obtained through plus.runtime.version, and through [plus.runtime.getProperty](https 😕/www.html5plus.org/doc/zh_cn/runtime.html#plus.runtime.getProperty) to get the wgt resource version.

# networkTimeout

The timeout period of various network requests, in milliseconds.

Attribute Type Required Default Description
request Number No 60000 The timeout of uni.request, in milliseconds.
connectSocket Number No 60000 The timeout of uni.connectSocket, in milliseconds.
uploadFile Number No 60000 The timeout time of uni.uploadFile, in milliseconds.
downloadFile Number No 60000 The timeout time of uni.downloadFile, in milliseconds.

Since HBuilderX 2.5.10, the above default timeout time has been changed from 6 seconds to 60 seconds to align with the WeChat MiniApp platform.

# uniStatistics

uni statistics configuration items

Attribute Type Required Default Description
enable Boolean yes true whether to enable uni statistics

# app-plus

Properties Type Description Minimum Version
splashscreen Object App startup interface information, see details
screenOrientation Array Gravity sensing, horizontal and vertical screen configuration, possible values: "portrait-primary": positive direction of vertical screen; "portrait-secondary": reverse direction of vertical screen; "landscape-primary": positive direction of horizontal screen;" landscape-secondary": The opposite direction of landscape screen.
modules Object permission module, see details
distribute Object App distribution information, see details
nvueCompiler String Switch nvue compilation mode, optional value, weex: old compilation mode, uni-app: new compilation mode, the default is weex. Compilation mode difference details 2.0.3+
nvueStyleCompiler String Switch nvue style compilation mode, optional value, weex: old compilation mode, uni-app: new compilation mode, default is weex. Compilation mode difference details 3.1.1+
renderer String You can not load the webview-based runtime framework, reducing the package size and improving the startup speed. Optional value native App-nvue 2.2.0+
nvueLaunchMode String Nvue home page launch mode, optional values: normal, fast, default normal (HBuilderX 2.4.4-2.4.9 is fixed to fast) [see details](https://ask.dcloud.net.cn/article /36749) 2.5.0+
nvue Object Initial configuration of nvue page layout, see details 2.0.3+
optimization Object Subpackage configuration, which can reduce the number of js loaded at startup and improve startup speed 2.7.12+
runmode String normal: default mode, liberate: resource release mode
uniStatistics Object Whether the App enables uni statistics, the configuration method is the same as the global configuration 2.2.3+
webView Object When the system webview is lower than the specified version, a prompt will pop up. Or continue to start after downloading the x5 kernel, only supported by Android, Details 3.5.0+

PS: The above table only lists the core parts. There are actually many configurations of the App platform. For the complete content, please refer to Complete manifest.json.

Tips

  • The configuration of the manifest.json file is recommended to be completed in the visual operation interface provided by HBuilderX.
  • Some configurations are completed in the operation interface when packaging, such as certificates and other information.
  • The Native.js permissions section will be automatically populated after packaging according to the configured module permissions.
  • Some modules are default and do not need to be configured.
  • Information such as appid of the WeChat MiniApp needs to be configured under the mp-weixin node. Do not configure it under app-plus. The weixin node under sdkConfigs configures the third-party SDK information of the App.

# App Splashscreen

Splash (startup cover) is an inevitable existence of App and cannot be cancelled.

Attribute Type Default Description Minimum Version
alwaysShowBeforeRender Boolean true Whether to wait for the homepage to be rendered before closing the startup interface 1.6.0
autoclose Boolean true Whether to automatically close the startup interface, it only takes effect when alwaysShowBeforeRender is set to false, if you need to [manually close](https://www.html5plus.org/doc/zh_cn/navigator.html#plus.navigator .closeSplashscreen) to start the interface, you need to set alwaysShowBeforeRender and autoclose to false.
waiting Boolean true Whether to display the waiting circle or snowflake on the program startup interface

alwaysShowBeforeRender和autoclose属性组合设置,可配置以下三种关闭启动界面(splash)策略,详见

注意

  • If you do not configure your own splash image, the app will put the icon of the app in the splash by default
  • Splash can only be a standard png, do not use jpg to rename it to png. Animations such as gif are also not supported
  • Relevant changes, cloud packaging takes effect, but real machine operation does not take effect. Local packaging needs to be configured in the native project by itself
  • App启动图中iOS的MAX等大屏设备的splash图若不配,会导致iOS认为此App没有为MAX优化,App将无法全屏,四周会有黑边
  • Android的splash支持.9.png,详见

# App Modules

Module selection is to control the package size of the App, and unnecessary modules can be removed during packaging.

Name Description
Bluetooth BLE Bluetooth
Contacts System Address Book
iBeacon iBeacon
LivePusher Live push stream
Maps Maps
Messaging Short color email message
OAuth Login Authorization
Payment Payment
Push Message Push
Share Social Sharing
Speech Speech Recognition
SQLite SQLite Database
Statistic Statistics
VideoPlayer Video Player

注意

  • Only App cloud packaging takes effect. Local packaging needs to be configured in the native project by itself.

# App Distribute

Attribute Type Description
android Object Android application configuration, see: Android configuration details
ios Object iOS application configuration, see: iOS configuration details
sdkConfigs Object SDK configuration, only packaged to take effect see details
orientation Array Same as screenOrientation configuration, only packaged and effective, deprecated, recommended to use screenOrientation

# App SdkConfigs

Three-party native SDK configuration. The use of the third-party SDK needs to apply to these SDK providers, and configure parameters here. The configuration can be entered in the HBuilderX visual interface (App SDK configuration), this configuration only takes effect after cloud packaging, local packaging needs to be configured in the native project by itself.

Attribute Type Description
oauth Object Authorized login, after configuration, you can call uni.login to log in. Currently supported authorized login platforms are: [QQ](http://open .qq.com/), WeChat, [Sina Weibo] (http://open.weibo.com/).
share Object Share, after configuration, you can call uni.share to share, currently supports QQ, WeChat, Sina Weibo and other sharing, specific configuration [see]( /api/plugins/share?id=App-side sharing configuration instructions for each platform).
push Object push configuration, usage method see, currently supports: uniPush, [unipush](http: //www.igetui.com/), note that the app only supports one push method, and multiple push configurations are invalid. It is recommended to use uniPush, which supports multi-vendor push.
payment Object Three-party payment configuration, after configuration, you can call uni.payment to make payment, currently supports WeChat payment, Alipay payment, Apple in-app purchase, specific configuration [see ](/api/plugins/payment?id=uni-app-app-platform payment process).
statics Object Statistics configuration, currently only pay for Youmeng statistics, see details, in uni-app only use [plus.statistic](http://www.html5plus.org /doc/zh_cn/statistic.html) to call.
speech Object Speech recognition configuration, support Xunfei voice, Baidu voice, see for details, only use [plus.speech](http://www.html5plus in uni-app .org/doc/zh_cn/speech.html) to call.
maps Object Native map configuration, currently only supports Automap, the application method can refer to: Map plugin configuration.

# optimization

It can reduce the number of js loaded at startup and improve startup speed.

Starting from uni-app 2.7.12+, the App-vue platform is also compatible with the subpackage configuration of MiniApp, but it is not enabled by default.

Configure the following nodes in the manifest to start subcontracting on the App side.

Attribute Type Description
subPackages Boolean 是否开启分包优化,目前仅 uni-app vue2 下生效
{
  "app-plus": {
    "optimization": {
      "subPackages": true
    },
    "runmode" : "liberate" // 开启分包优化后,必须配置资源释放模式
  }
}

After starting the subpackage in the manifest, you need to configure specific subpackage rules in pages.json, which is the same as the configuration of the MiniApp. For details, see: https://uniapp.dcloud.io/collocation/pages?id=subpackages

That is, once subcontracting is configured in pages.json, the MiniApp must take effect, and whether the app takes effect depends on whether it is enabled in the manifest.

注意:

  • After the App opens subpackages, each subpackage is compiled into a separate js file (all included in the app and will not be downloaded online). When the App home page is vue, the size of the startup loading file can be reduced and the startup speed can be improved.
  • When the homepage is nvue, subpackaging will not increase the startup speed. The startup speed of nvue itself is faster than that of vue, and it is also faster than the application whose homepage is vue after subpackaging is enabled. If you pursue the ultimate startup speed, you should still use nvue as the home page and enable fast mode in the manifest.
  • When the number of App pages is small, the optimization of the startup speed by subpackaging is not obvious.

# nvue

nvue page layout initial setup

Attribute Type Description
flex-direction String Arrangement direction of flex member items, supporting items, row: from left to right; row-reverse: from right to left; column: from top to bottom; column-reverse: opposite to column, default value column.

# webview

uni-app 3.5.0+

When the App code uses a grammar that is not supported by a lower version of webview (such as using vue3), you can configure this property in the manifest to specify the minimum running webview version.

当系统webview版本不符合需求时,uni-app引擎会自动弹框。同时开发者可以指定使用 x5引擎webview 来替代系统webview,以保障浏览器兼容性。详见x5文档

When your application strongly relies on x5, for example, when you need to keep the font of the vue page consistent with native interfaces such as tabbar, you can also configure this property in the manifest.

Attribute Type Description
minUserAgentVersion String The minimum webview version, for example: 64.0.3282.116. (When the minimum version requirement is lower than the minimum version, a WebView version is too low pop-up box will be displayed, click OK to exit the application.)
x5 Object This attribute needs to check the Android X5 Webview module in the manifest module configuration, see the description below for details

x5 attribute description

Attribute Type Default Description
timeOut Number 3000 timeout time
showTipsWithoutWifi Boolean false Whether to display a pop-up window for the user to confirm downloading the x5 kernel in a non-WiFi network environment. (If it is true, when downloading the x5 module on a non-WiFi network, a user confirmation pop-up box will be displayed, the content is Currently in a non-WiFi network, is it allowed to download the x5 module?, when false, no pop-up box will be displayed.)
allowDownloadWithoutWiFi Boolean false Whether to allow the user to download the x5 kernel when not on a WiFi network. (If it is true, the pop-up window for user confirmation will not be displayed. When it is false, if showTipsWithoutWifi is true, the user confirmation pop-up box will be displayed; when showTipsWithoutWifi is false, the x5 module will not be downloaded.)

webview example

{
  "app-plus" : {
    "webView": {
      "minUserAgentVersion": "64.0.3282.116",
      "x5": {
        "timeOut": 3000,
        "showTipsWithoutWifi": true,
        "allowDownloadWithoutWiFi": false
      }
    }
  }
}

Tip: The vue3 vue page requires the minimum version of the Android system webview to be 64.0.3282.116

# h5

Attribute Type Description
title String 页面标题,默认使用 manifest.json 的 name
template String index.html 模板路径,相对于应用根目录,可定制生成的 html 代码。参考:自定义模板, Vue2 支持,Vue3 暂不支持
router Object Reference: router
async Object Reference: async
devServer Object 开发环境 server 配置,参考:devServer
publicPath String 引用资源的地址前缀,仅 Vue2 发布时生效。参考:publicPath
sdkConfigs String SDK configuration, such as map... Reference: sdkConfigs
optimization Object Package optimization configuration (supported by HBuilderX 2.1.5 and above), refer to optimization
uniStatistics Object Whether to enable uni statistics in H5, the configuration method is the same as the global configuration

# 自定义模板

目前 Vue2 支持, Vue3 暂不支持

Scenarios that require the use of custom templates usually have the following situations:

  • Adjust the meta configuration in the page head
  • Supplement some configurations related to SEO (only the home page)
  • Join Baidu statistics and other three-party js

使用自定义模板时,1. 工程根目录下新建一个html文件;2. 复制下面的基本模板内容,到这个html文件,在此基础上修改meta和引入js;3. 在 manifest.json->h5->template 节点中关联这个html文件的路径。

<!DOCTYPE html>
<html lang="zh-CN">
	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<title>
			<%= htmlWebpackPlugin.options.title %>
		</title>
		<!-- Open Graph data -->
		<!-- <meta property="og:title" content="Title Here" /> -->
		<!-- <meta property="og:url" content="http://www.example.com/" /> -->
		<!-- <meta property="og:image" content="http://example.com/image.jpg" /> -->
		<!-- <meta property="og:description" content="Description Here" /> -->
		<script>
			var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || CSS.supports('top: constant(a)'))
			document.write('<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + (coverSupport ? ', viewport-fit=cover' : '') + '" />')
		</script>
		<link rel="stylesheet" href="<%= BASE_URL %>static/index.<%= VUE_APP_INDEX_CSS_HASH %>.css" />
	</head>
	<body>
		<noscript>
			<strong>Please enable JavaScript to continue.</strong>
		</noscript>
		<div id="app"></div>
		<!-- built files will be auto injected -->
	</body>
</html>

There is a template.h5.html file in the hello uni-app example, which is used for this purpose.

Additional note about SEO

The H5 platform is a SPA single-page application. Common SEO information, that is, adding meta fields can only be configured on the homepage in the custom template html.

But the era of SEO is changing, and now a more effective way is to use uni-app to release a version of Baidu MiniApp at the same time, which has a higher search weight. The H5 version of DCloud's ask community is also made by uni-app. At the same time, a Baidu MiniApp is released, which has a higher weight and a lot of searches from Baidu every day. It's a good case to speak for itself.

# router

Attribute Type Default Description
mode String hash routing jump mode, support hash, history
base String / Application base path, for example, if the entire single-page application service is under /app/, then the base should be set to "/app/", and it is supported to be set to a relative path "./"

Notice:

  • history mode is not supported by some browsers, and the built-in browser of iOS WeChat cannot observe URL changes, and the default sharing (does not use WeChat JSSDK case) is the entry page link.
  • history 模式发行需要后台配置支持,详见:history 模式的后端配置
  • base 参数设置为空或者 /,应用运行在 / 根目录下。
  • 参数设置为 ./ 时,应用运行在相对路径下,可配合 nginx 等工具运行在任意路径中。

# async

Attribute Type Default Description
loading String AsyncLoading the component used when page js is loaded (need to be registered as a global component)
error String AsyncError The component used when the page js fails to load (need to be registered as a global component)
delay Number 200 Display the delay time of the loading loading component (if the page js is loaded within the delay time, the loading component will not be displayed)
timeout Number 60000 page js loading timeout time (the component corresponding to error will be displayed after timeout)

# devServer

Attribute Type Default Description
https Boolean false Enable https protocol
port Number Vue2 8080; Vue3 3000 Front-end development service port
disableHostCheck Boolean false Disable Host Check

Tips:uni-appmanifest.json->h5->devServervue2 实际上对应 webpackdevServervue3 实际上对应 viteserver,鉴于 manifest 为 json 文件,故 webpack.config.js->devServervite.config.js->server 配置项下的简单类型属性均可在manifest.json->h5->devServer节点下配置,funciton 等复杂类型暂不支持。

# publicPath

Configure publicPath as the prefix of the cdn resource address, so that the compiled html file, the referenced js, and css paths will automatically become the address on the cdn.

Note: If you want to take effect on the image, the image address of the image component needs to use a relative path

example

Take hello-uniapp as an example when releasing H5

Result in index.html when publishing when no publicPath is configured:

<script src=/h5/static/js/chunk-vendors.803ce52d.js></script>
<script src=/h5/static/js/index.34e8497d.js>

After configuring publicPath to https://www.cdn.com/h5/ (invalid address is just used as an example), the result in index.html when publishing:

<script src=https://www.cdn.com/h5/static/js/chunk-vendors.803ce52d.js></script>
<script src=https://www.cdn.com/h5/static/js/index.34e8497d.js>

注意

  • After packaging and deploying, enable gzip on the server to further compress the file. For specific configuration, please refer to the online sharing: https://juejin.im/post/5af003286fb9a07aac24611b

# sdkconfig

Three-party SDK configuration. The use of the third-party SDK needs to apply to these SDK providers, and configure parameters here. The configuration can be entered in the HBuilderX visual interface (H5 configuration).

Attribute Type Description
maps Object Map or location-related SDK

# maps

Map service provider SDK configuration, this item needs to be configured when using maps and locations (IP positioning and coordinate conversion).

example

{
"h5": {
	"sdkConfigs": {
		// To use map or location-related functions, one must be filled in
		"maps": {
            "qqmap": {
                // Tencent map key https://lbs.qq.com/dev/console/key/manage
                "key": ""
            },
            "google": {
                // Google Maps key (HBuilderX 3.2.10+) https://developers.google.com/maps/documentation/javascript/get-api-key
                "key": ""
            },
            "amap": {
                // Amap key (HBuilderX 3.6.0+) https://console.amap.com/dev/key/app
                "key": "",
                // Amap security key (HBuilderX 3.6.0+) https://console.amap.com/dev/key/app
                "securityJsCode": "",
                // Amap security key proxy server address (HBuilderX 3.6.0+) https://lbs.amap.com/api/jsapi-v2/guide/abc/prepare
                "serviceHost": "",
            },
            "bmap": {
                // 百度地图秘钥(HBuilderX 3.99+)http://lbsyun.baidu.com/apiconsole/key#/home
                "key": ""
            }
		}
	}
}
}

# optimization

Attribute Type Default Description
prefetch Boolean false resource prefetch
preload Boolean false resource preload
treeShaking Object tree-shaking optimization, according to project requirements, dynamically package the components and API required by the framework, keep the framework code as simple as possible, refer to treeShaking
# treeShaking
Attribute Type Default Description
enable Boolean false whether to enable tree shaking optimization

示例:

{
    "h5": {
        "optimization": {
            "treeShaking": {
                "enable": true
            }
        }
    }
}

Tips: For treeshaking optimization (treeShaking) principle and optimization results, refer to: https://ask.dcloud.net.cn/article/36279

# mp-weixin

Attribute Type Description
appid String AppID of the WeChat MiniApp, log in https://mp.weixin.qq.com to apply
setting Object WeChat MiniApp project settings, refer to setting
functionalPages Boolean Whether to enable the plug-in function page of the WeChat MiniApp, it is disabled by default
requiredBackgroundModes Array WeChat MiniApp needs to be used in the background, see
plugins Object The plugin used, see details
resizable Boolean 在iPad上小程序是否支持屏幕旋转,默认关闭
navigateToMiniProgramAppIdList Array 需要跳转的小程序列表,详见
permission Object WeChat MiniApp interface permission related settings, such as applying for location permission must be filled here see details
workers String The directory where the Worker code is placed. See details
optimization Object Optimization configuration for WeChat MiniApp
cloudfunctionRoot String Configure cloud development directory, refer to setting
uniStatistics Object Whether to enable uni statistics in the WeChat MiniApp, the configuration method is the same as the global configuration
scopedSlotsCompiler String Vue2 作用域插槽编译模式,uni-app 3.1.19+ 开始支持,可选:legacy、auto、augmented,默认:auto
mergeVirtualHostAttributes Boolean 合并组件虚拟节点外层属性(目前仅支持 style、class 属性),uni-app 3.5.1+ 开始支持
slotMultipleInstance Boolean 模拟单个作用域插槽渲染为多个实例,此配置仅限 Vue2 环境 3.7.12+,Vue3 环境已默认支持
embeddedAppIdList Array 要半屏跳转的小程序appid。详见
requiredPrivateInfos Array 地理位置相关接口。详见
lazyCodeLoading String support only requiredComponents,Represents opening the MiniApp On-demand injectionfeature,Details

# setting

Compile to the project settings under the WeChat MiniApp platform.

Attribute Type Description
urlCheck Boolean Whether to check secure domain name and TLS version
es6 Boolean ES6 to ES5
postcss Boolean Whether the style is automatically completed when uploading the code
minified Boolean Whether to automatically compress code when uploading
bigPackageSizeSupport Boolean Whether to adjust the upper limit of the package size to 4M when previewing and real-device debugging, the default is true (HBuilderX 3.5.5+).

注意: 使用微信小程序手势组件会强制开启 ES6 转 ES5

# optimization

Optimized configuration for WeChat MiniApp

Attribute Type Description
subPackages Boolean Whether to enable subpackage optimization

# cloudfunctionRoot

If you need to use the cloud development of WeChat MiniApp, you need to configure the cloud development directory in mp-weixin

"mp-weixin":{
  // ...
   "cloudfunctionRoot": "cloudfunctions/", // 配置云开发目录
  // ...
}

After configuring the directory, you need to create a new vue.config.js in the project root directory to configure the corresponding file compilation rules

{
 plugins: [
     new CopyWebpackPlugin([
       {
         from: path.join(__dirname, '../cloudfunctions'),
         to: path.join(__dirname, 'unpackage', 'dist', process.env.NODE_ENV === 'production' ? 'build' : 'dev', process.env.UNI_PLATFORM, 'cloudfunctions'),
       },
     ]),
   ],
}

# mp-alipay

Property Type Description
plugins Object Plugins used, see details
component2 Boolean Whether to enable component2 compilation, the default is true, View Details
enableAppxNg Boolean Whether to enable the enableAppxNg MiniApp base library 2.x build, the default is true, View Details, HBuilderX 3.2.10+
axmlStrictCheck Boolean Whether to enable axml strict syntax checking, default is false
enableParallelLoader Boolean Whether to enable multi-process compilation, the default is false
enableDistFileMinify Boolean Whether to compress the compiled product (only valid in real device preview/real device debugging), the default is false
uniStatistics Object Whether the Alipay MiniApp enables uni statistics, the configuration method is the same as the global configuration
scopedSlotsCompiler String Vue2 作用域插槽编译模式,uni-app 3.1.19+ 开始支持,可选:legacy、auto、augmented,默认:auto
mergeVirtualHostAttributes Boolean 合并组件虚拟节点外层属性(目前仅支持 style、class 属性),uni-app 3.5.1+ 开始支持
slotMultipleInstance Boolean 模拟单个作用域插槽渲染为多个实例,此配置仅限 Vue2 环境 3.7.12+,Vue3 环境已默认支持
lazyCodeLoading String 是否开启代码按需执行。
styleIsolation String 组件样式隔离方式,默认值为 apply-shared,具体配置 详见。 uni-app 3.99+ 开始支持

# mp-baidu

Attribute Type Description
appid String AppID of Baidu MiniApp, log in https://smartprogram.baidu.com/docs/introduction/enter_application/ to apply
requiredBackgroundModes Array MiniApp need the ability to be used in the background, and currently support background audio playback, "requiredBackgroundModes": ["audio"], see details
prefetches Array A list of all pre-requested urls, see details
optimization Object optimization configuration for Baidu MiniApp
uniStatistics Object Whether to enable uni statistics in the Baidu MiniApp, the configuration method is the same as the global configuration
scopedSlotsCompiler String Vue2 作用域插槽编译模式,uni-app 3.1.19+ 开始支持,可选:legacy、auto、augmented,默认:auto
slotMultipleInstance Boolean 模拟单个作用域插槽渲染为多个实例,此配置仅限 Vue2 环境 3.7.12+,Vue3 环境已默认支持
dynamicLib Object Introduce a dynamic library, please refer to Use a dynamic library

# optimization

Optimized configuration for Baidu MiniApp

Attribute Type Description
subPackages Boolean Whether to enable subpackage optimization

# mp-toutiao

Attribute Type Description
appid String 抖音小程序的 AppID,登录 https://microapp.bytedance.com/ 申请
setting Object 抖音小程序项目设置,参考抖音小程序项目设置
navigateToMiniProgramAppIdList Array 需要跳转的小程序列表,详见
uniStatistics Object 抖音小程序是否开启 uni 统计,配置方法同全局配置
scopedSlotsCompiler String Vue2 作用域插槽编译模式,uni-app 3.1.19+ 开始支持,可选:legacy、auto、augmented,默认:auto
slotMultipleInstance Boolean 模拟单个作用域插槽渲染为多个实例,此配置仅限 Vue2 环境 3.7.12+,Vue3 环境已默认支持

# 抖音小程序项目设置

Attribute Type Description
urlCheck Boolean Whether to check secure domain name and TLS version
es6 Boolean ES6 to ES5
postcss Boolean Whether the style is automatically completed when uploading the code
minified Boolean Whether to automatically compress code when uploading

# mp-lark

Attribute Type Description
appid String AppID of the Feishu MiniApp, log in to https://open.feishu.cn to apply
setting Object Feishu MiniApp project settings, refer to Feishu MiniApp project settings
uniStatistics Object Whether the Feishu MiniApp enables uni statistics, the configuration method is the same as the global configuration
scopedSlotsCompiler String Vue2 作用域插槽编译模式,uni-app 3.1.19+ 开始支持,可选:legacy、auto、augmented,默认:auto
slotMultipleInstance Boolean 模拟单个作用域插槽渲染为多个实例,此配置仅限 Vue2 环境 3.7.12+,Vue3 环境已默认支持

# Feishu MiniApp project setting

Attribute Type Description
urlCheck Boolean Whether to check secure domain name and TLS version
es6 Boolean ES6 to ES5
postcss Boolean Whether the style is automatically completed when uploading the code
minified Boolean Whether to automatically compress code when uploading

# mp-qq

Property Type Description
appid String The AppID of the qq MiniApp, log in https://q.qq.com to apply
requiredBackgroundModes Array The ability of the MiniApp to be used in the background, currently supports background audio playback, "requiredBackgroundModes": ["audio"], see details
navigateToMiniProgramAppIdList Array A list of MiniApp that need to be redirected, see details
permission Object MiniApp interface permission-related settings, such as applying for location permissions must be filled here see details
workers String The directory where the Worker code is placed. See details
groupIdList String Array The list of group IDs that need to open the group data card, see the open-type of the button for details
optimization Object optimization configuration of QQ MiniApp
uniStatistics Object Whether to enable uni statistics in the QQ MiniApp, the configuration method is the same as the global configuration
scopedSlotsCompiler String Vue2 作用域插槽编译模式,uni-app 3.1.19+ 开始支持,可选:legacy、auto、augmented,默认:auto
slotMultipleInstance Boolean 模拟单个作用域插槽渲染为多个实例,此配置仅限 Vue2 环境 3.7.12+,Vue3 环境已默认支持

# optimization

Optimized configuration for QQ MiniApp

Attribute Type Description
subPackages Boolean Whether to enable subpackage optimization

# mp-kuaishou

Attribute Type Description
appid String AppID of the Kuaishou MiniApp, log in https://mp.kuaishou.com to apply
optimization Object optimization configuration of Kuaishou MiniApp
uniStatistics Object Whether the Kuaishou MiniApp enables uni statistics, the configuration method is the same as the global configuration
scopedSlotsCompiler String Vue2 作用域插槽编译模式,uni-app 3.1.19+ 开始支持,可选:legacy、auto、augmented,默认:augmented
slotMultipleInstance Boolean 模拟单个作用域插槽渲染为多个实例,此配置仅限 Vue2 环境 3.7.12+,Vue3 环境已默认支持

# optimization

Optimized configuration for Kuaishou MiniApp

Attribute Type Description
subPackages Boolean Whether to enable subpackage optimization

# Custom MiniApp project configuration

HBuilderX 3.6.16+ supports creating a configuration file in the project root directory (cli project is the src directory) to customize the configuration of the MiniApp project. The platform corresponding file name is as follows:

MiniApp Platform File Name
QQ project.config.json
Baidu project.swan.json
支付宝 mini.project.json
抖音 project.tt.json
Feishu project.lark.json
Kuaishou project.ks.json
Jingdong project.config.json

# Explanation on subpackage optimization

  • Add "optimization":{"subPackages":true} under the configuration of the corresponding platform to enable subpackage optimization
  • Currently only supports subpackage optimization of mp-weixin, mp-qq, mp-baidu, mp-toutiao, mp-kuaishou
  • Specific logic of subcontract optimization:
    • Static files: Static resources such as static are supported under the subpackage, that is, the static resources placed in the subpackage directory will not be packaged into the main package, nor can they be used in the main package
    • js file: When a js is only referenced by one subpackage, the js will be packaged into the subpackage, otherwise it will still be packaged into the main package (that is, it is referenced by the main package, or it is referenced by more than one subpackage)
    • Custom component: If a custom component is only referenced by one subpackage and is not placed in the subpackage, a prompt message will be output during compilation

Example of static files in subpackage

"subPackages": [{
	"root": "pages/sub",
	"pages": [{
		"path": "index/index"
	}]
}]

Taking the above subpackage as an example, the static files placed in the directory corresponding to the root of each subpackage will be packaged into this subpackage.

# QuickApp

Property Type Description
icon String Application icon, recommended by Huawei 192x192
package String application package name
minPlatformVersion Number Minimum platform support (Huawei minimum 1070, vivo 1063)
versionName String version name
versionCode Number Version number

manifest.json配置

{
  "quickapp-webview": {// 快应用通用配置
    "icon": "/static/logo.png",
    "package": "com.example.demo",
    "versionName": "1.0.0",
    "versionCode": 100
  },
  "quickapp-webview-union": {// 快应用联盟,目前仅支持 vivo、oppo
    "minPlatformVersion": 1063 //最小平台支持
  },
  "quickapp-webview-huawei": {// 快应用华为
    "minPlatformVersion": 1070 //最小平台支持
  }
}

# FAQ

Q: How to modify the pop-up prompts when the iOS app calls the camera and other permissions? A: In the manifest.json visual interface - App module permission configuration - iOS privacy information access permission description