提交 7f2da509 编写于 作者: fxy060608's avatar fxy060608

fix(mp-alipay): add subPackageBuildType (question/140742)

上级 6cedefee
......@@ -125,4 +125,5 @@ export interface AppJson {
lazyCodeLoading?: 'requiredComponents' | string
singlePage?: SinglePage
restartStrategy?: RestartStrategy
[name: string]: unknown
}
......@@ -221,6 +221,11 @@ const options = {
darkmode: false,
subpackages: true,
plugins: true,
normalize(appJson) {
// 支付宝小程序默认主包,分包 js 模块不共享,会导致 getCurrentInstance,setCurrentInstance 不一致
appJson.subPackageBuildType = 'shared';
return appJson;
},
},
project: {
filename: projectConfigFilename,
......
......@@ -102,6 +102,11 @@ export const options: UniMiniProgramPluginOptions = {
darkmode: false,
subpackages: true,
plugins: true,
normalize(appJson) {
// 支付宝小程序默认主包,分包 js 模块不共享,会导致 getCurrentInstance,setCurrentInstance 不一致
appJson.subPackageBuildType = 'shared'
return appJson
},
},
project: {
filename: projectConfigFilename,
......
......@@ -10,6 +10,7 @@ import {
MiniProgramCompilerOptions,
initPostcssPlugin,
parseRpx2UnitOnce,
AppJson,
} from '@dcloudio/uni-cli-shared'
import type {
SFCDescriptor,
......@@ -58,6 +59,7 @@ export interface UniMiniProgramPluginOptions {
* 是否支持发行插件
*/
plugins?: boolean
normalize?: (appJson: AppJson) => AppJson
}
project?: {
filename: string
......
......@@ -69,7 +69,8 @@ export function uniPagesJsonPlugin(
if (options.json?.formatAppJson) {
options.json.formatAppJson(appJson, manifestJson, pageJsons)
}
addMiniProgramAppJson(appJson)
const { normalize } = options.app
addMiniProgramAppJson(normalize ? normalize(appJson) : appJson)
Object.keys(pageJsons).forEach((name) => {
addMiniProgramPageJson(name, pageJsons[name])
})
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册