diff --git a/packages/uni-cli-shared/lib/cache.js b/packages/uni-cli-shared/lib/cache.js index 69e10165026e3d5b0a7704191c4b4dda297f0131..7b526016b476ef9dcafd05bea6e930996432ed72 100644 --- a/packages/uni-cli-shared/lib/cache.js +++ b/packages/uni-cli-shared/lib/cache.js @@ -53,21 +53,30 @@ function getChangedJsonFileMap (clear = true) { } function updateAppJson (name, jsonObj) { - updateComponentJson(name, jsonObj) + updateComponentJson(name, jsonObj, true, 'App') } function updatePageJson (name, jsonObj) { pageSet.add(name) - updateComponentJson(name, jsonObj) + updateComponentJson(name, jsonObj, true, 'Page') } function updateProjectJson (name, jsonObj) { - updateComponentJson(name, jsonObj, false) + updateComponentJson(name, jsonObj, false, 'Project') } const supportGlobalUsingComponents = process.env.UNI_PLATFORM === 'mp-weixin' || process.env.UNI_PLATFORM === 'mp-qq' -function updateComponentJson (name, jsonObj, usingComponents = true) { +function updateComponentJson (name, jsonObj, usingComponents = true, type = 'Component') { + if (type === 'Component') { + jsonObj.component = true + } + if (type === 'Page') { + if (process.env.UNI_PLATFORM === 'mp-baidu') { + jsonObj.component = true + } + } + const oldJsonStr = getJsonFile(name) if (oldJsonStr) { // update if (usingComponents) { // merge usingComponents