提交 b7b354ab 编写于 作者: D DCloud_LXH

fix(mp): 小程序平台使用插槽热更新时,丢失 genericComponents 信息 question/136258

上级 ebbbe353
......@@ -82,11 +82,14 @@ function updateComponentJson (name, jsonObj, usingComponents = true, type = 'Com
const oldJsonStr = getJsonFile(name)
if (oldJsonStr) { // update
if (usingComponents) { // merge usingComponents
if (usingComponents) { // merge usingComponents
// 其实直接拿新的 merge 到旧的应该就行
const oldJsonObj = JSON.parse(oldJsonStr)
jsonObj.usingComponents = oldJsonObj.usingComponents || {}
jsonObj.usingComponents = oldJsonObj.usingComponents || {}
jsonObj.usingAutoImportComponents = oldJsonObj.usingAutoImportComponents || {}
if(oldJsonObj.genericComponents) {
jsonObj.genericComponents = oldJsonObj.genericComponents
}
if (oldJsonObj.usingGlobalComponents) { // 复制 global components(针对不支持全局 usingComponents 的平台)
jsonObj.usingGlobalComponents = oldJsonObj.usingGlobalComponents
}
......@@ -351,4 +354,4 @@ module.exports = {
updateGenericComponents,
getChangedJsonFileMap,
getSpecialMethods
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册