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

fix(mp): merge usingComponents into app.json (#3071)

上级 d10a4ac6
...@@ -37,7 +37,7 @@ export function normalizeJsonFilename(filename: string) { ...@@ -37,7 +37,7 @@ export function normalizeJsonFilename(filename: string) {
export function findChangedJsonFiles() { export function findChangedJsonFiles() {
const changedJsonFiles = new Map<string, string>() const changedJsonFiles = new Map<string, string>()
function findChangedFile(filename: string, json: Record<string, any>) { function findChangedFile(filename: string, json: Record<string, any>) {
const newJson = extend({}, json) const newJson = JSON.parse(JSON.stringify(json))
if (!newJson.usingComponents) { if (!newJson.usingComponents) {
newJson.usingComponents = {} newJson.usingComponents = {}
} }
......
...@@ -119,11 +119,19 @@ function parsePagesJson( ...@@ -119,11 +119,19 @@ function parsePagesJson(
// window // window
if (pagesJson.globalStyle) { if (pagesJson.globalStyle) {
appJson.window = parseWindowOptions( const windowOptions = parseWindowOptions(
pagesJson.globalStyle, pagesJson.globalStyle,
platform, platform,
windowOptionsMap windowOptionsMap
) )
const { usingComponents } = windowOptions as PageWindowOptions
if (usingComponents) {
delete (windowOptions as PageWindowOptions).usingComponents
appJson.usingComponents = usingComponents
} else {
delete appJson.usingComponents
}
appJson.window = windowOptions
} }
// tabBar // tabBar
...@@ -138,7 +146,7 @@ function parsePagesJson( ...@@ -138,7 +146,7 @@ function parsePagesJson(
appJson.tabBar = tabBar appJson.tabBar = tabBar
} }
} }
;['preloadRule', 'workers', 'usingComponents'].forEach((name) => { ;['preloadRule', 'workers'].forEach((name) => {
if (hasOwn(pagesJson, name)) { if (hasOwn(pagesJson, name)) {
appJson[name] = pagesJson[name] appJson[name] = pagesJson[name]
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册