From f3d3e2e4bdcdab290937f6fe047c21b8a4c53434 Mon Sep 17 00:00:00 2001 From: fxy060608 Date: Mon, 14 Oct 2019 21:26:02 +0800 Subject: [PATCH] fix(cli): component:true --- packages/uni-cli-shared/lib/cache.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/packages/uni-cli-shared/lib/cache.js b/packages/uni-cli-shared/lib/cache.js index 69e101650..7b526016b 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 -- GitLab