diff --git a/packages/uni-cli-shared/lib/cache.js b/packages/uni-cli-shared/lib/cache.js index ef8e2969464c5c2f7beab77959a33eb228f8d881..e2f27650e67b37dd5336824b30dc1f23d29e3e0e 100644 --- a/packages/uni-cli-shared/lib/cache.js +++ b/packages/uni-cli-shared/lib/cache.js @@ -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 -} +} diff --git a/packages/vue-cli-plugin-uni/lib/h5/index.js b/packages/vue-cli-plugin-uni/lib/h5/index.js index 2072a04d4fca01545daec95f79b952e683589a66..82a26ba4f54c627789432d91b96a678f1106f827 100644 --- a/packages/vue-cli-plugin-uni/lib/h5/index.js +++ b/packages/vue-cli-plugin-uni/lib/h5/index.js @@ -155,6 +155,9 @@ module.exports = { } }, plugins, + optimization: { + moduleIds: 'hashed' + }, devServer: { watchOptions: require('../util').getWatchOptions() }