From 928fbd2e084bff8117bb4a19fb58d06eab99e3d5 Mon Sep 17 00:00:00 2001 From: songyu Date: Mon, 11 Apr 2022 11:32:20 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=8B=AC=E7=AB=8B=E5=88=86=E5=8C=85?= =?UTF-8?q?=E5=BC=80=E5=85=B3=E5=90=8D=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/uni-cli-shared/lib/cache.js | 2 +- packages/uni-cli-shared/lib/pages.js | 2 +- packages/uni-mp-weixin/lib/createIndependentPlugin.js | 4 ++-- .../inject-main-css-to-independent-plugin.js | 2 +- .../optimize-components-position/index.js | 4 ++-- packages/uni-mp-weixin/lib/uni.config.js | 2 +- packages/webpack-uni-mp-loader/lib/plugin/generate-json.js | 6 +++--- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/uni-cli-shared/lib/cache.js b/packages/uni-cli-shared/lib/cache.js index 3f0ad56ca..2e3fb63cc 100644 --- a/packages/uni-cli-shared/lib/cache.js +++ b/packages/uni-cli-shared/lib/cache.js @@ -106,7 +106,7 @@ function updateComponentJson (name, jsonObj, usingComponents = true, type = 'Com function updateUsingGlobalComponents (name, usingGlobalComponents) { const manifestConfig = process.UNI_MANIFEST; const weixinConfig = manifestConfig['mp-weixin']; - const independentSwitch = !!weixinConfig.independentSwitch; + const independentSwitch = !!weixinConfig.independent; if (!independentSwitch && supportGlobalUsingComponents) { return; diff --git a/packages/uni-cli-shared/lib/pages.js b/packages/uni-cli-shared/lib/pages.js index 41a2da132..402bf3572 100644 --- a/packages/uni-cli-shared/lib/pages.js +++ b/packages/uni-cli-shared/lib/pages.js @@ -211,7 +211,7 @@ function parseEntry (pagesJson) { } const manifestConfig = process.UNI_MANIFEST; const weixinConfig = manifestConfig['mp-weixin'] || {}; - const independentSwitch = !!weixinConfig.independentSwitch; + const independentSwitch = !!weixinConfig.independent; if (independentSwitch) { Object.values(process.UNI_SUBPACKAGES).forEach(({ root, independent = false }) => { if (root && independent) { diff --git a/packages/uni-mp-weixin/lib/createIndependentPlugin.js b/packages/uni-mp-weixin/lib/createIndependentPlugin.js index 5a3166236..be2e9cf48 100644 --- a/packages/uni-mp-weixin/lib/createIndependentPlugin.js +++ b/packages/uni-mp-weixin/lib/createIndependentPlugin.js @@ -11,7 +11,7 @@ const AppInterceptorPlugin = require('./independent-plugins/app-interceptor-plug module.exports = function createIndependentPlugins () { const manifestConfig = process.UNI_MANIFEST; const weixinConfig = manifestConfig['mp-weixin']; - const independentSwitch = !!weixinConfig.independentSwitch; + const independentSwitch = !!weixinConfig.independent; if (!independentSwitch) return []; // 支持构造微信小程序的独立分包 @@ -27,7 +27,7 @@ module.exports = function createIndependentPlugins () { new AppInterceptorPlugin() ]; - const insertAppCssToIndependentSwitch = !!weixinConfig.insertAppCssToIndependentSwitch; + const insertAppCssToIndependentSwitch = !!weixinConfig.insertAppCssToIndependent; if (insertAppCssToIndependentSwitch) { // 需要在 cacheSet 后面 independentPlugins.push(new InjectMainCssToIndependentCssPlugin()); // 目前只对页面注入了,组件未注入 diff --git a/packages/uni-mp-weixin/lib/independent-plugins/inject-main-css-to-independent-plugin.js b/packages/uni-mp-weixin/lib/independent-plugins/inject-main-css-to-independent-plugin.js index f5326e73a..179d369e0 100644 --- a/packages/uni-mp-weixin/lib/independent-plugins/inject-main-css-to-independent-plugin.js +++ b/packages/uni-mp-weixin/lib/independent-plugins/inject-main-css-to-independent-plugin.js @@ -35,7 +35,7 @@ function copyWeuiCssToIndependent (independentRoot) { function tryInsertWeuiCss (independentRoot, originalWxssStr) { const manifestConfig = process.UNI_MANIFEST; const weixinConfig = manifestConfig['mp-weixin'] || {}; - const independentSwitch = !!weixinConfig.independentSwitch; + const independentSwitch = !!weixinConfig.independent; // 如果使用了weui,则需要注入weui样式 const useExtendedWeUi = !!(weixinConfig.useExtendedLib || {}).weui; diff --git a/packages/uni-mp-weixin/lib/independent-plugins/optimize-components-position/index.js b/packages/uni-mp-weixin/lib/independent-plugins/optimize-components-position/index.js index 5549ed0b0..514689316 100644 --- a/packages/uni-mp-weixin/lib/independent-plugins/optimize-components-position/index.js +++ b/packages/uni-mp-weixin/lib/independent-plugins/optimize-components-position/index.js @@ -13,8 +13,8 @@ class DependencyAnalyze { init (emitFileMap, compilation) { const manifestConfig = process.UNI_MANIFEST; const weixinConfig = manifestConfig['mp-weixin'] || {}; - const independentSwitch = !!weixinConfig.independentSwitch; - const copyWxComponentsOnDemandSwitch = !!weixinConfig.copyWxComponentsOnDemandSwitch; // 默认值false + const independentSwitch = !!weixinConfig.independent; + const copyWxComponentsOnDemandSwitch = !!weixinConfig.copyWxComponentsOnDemand; // 默认值false if (copyWxComponentsOnDemandSwitch) { // 开启按需复制 new CopyWxComponentOnDemand(emitFileMap, this.AnalyzeWxcomponentDependency, compilation).init(); diff --git a/packages/uni-mp-weixin/lib/uni.config.js b/packages/uni-mp-weixin/lib/uni.config.js index 70e383588..669027976 100644 --- a/packages/uni-mp-weixin/lib/uni.config.js +++ b/packages/uni-mp-weixin/lib/uni.config.js @@ -44,7 +44,7 @@ module.exports = { const manifestConfig = process.UNI_MANIFEST; const weixinConfig = manifestConfig['mp-weixin'] || {}; - const copyWxComponentsOnDemandSwitch = !!weixinConfig.copyWxComponentsOnDemandSwitch; // 默认值false + const copyWxComponentsOnDemandSwitch = !!weixinConfig.copyWxComponentsOnDemand; // 默认值false if (!copyWxComponentsOnDemandSwitch) { const wxcomponentsDir = path.resolve(process.env.UNI_INPUT_DIR, COMPONENTS_DIR_NAME); diff --git a/packages/webpack-uni-mp-loader/lib/plugin/generate-json.js b/packages/webpack-uni-mp-loader/lib/plugin/generate-json.js index 62245d027..8d109fa70 100644 --- a/packages/webpack-uni-mp-loader/lib/plugin/generate-json.js +++ b/packages/webpack-uni-mp-loader/lib/plugin/generate-json.js @@ -224,9 +224,9 @@ module.exports = function generateJson (compilation) { for (const [name, jsonObj] of emitFileMap) { if (name === 'app.json') { // 删除manifest.json携带的配置项 - delete jsonObj.insertAppCssToIndependentSwitch; - delete jsonObj.independentSwitch; - delete jsonObj.copyWxComponentsOnDemandSwitch; + delete jsonObj.insertAppCssToIndependent; + delete jsonObj.independent; + delete jsonObj.copyWxComponentsOnDemand; } else { // 删除用于临时记录的属性 delete jsonObj.usingGlobalComponents; } -- GitLab