From dd22b3bd9dddd42d7735d5b6f8d09358790d48e9 Mon Sep 17 00:00:00 2001 From: wkj <278599135@qq.com> Date: Mon, 9 May 2022 15:14:48 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=96=E8=AF=91=20app.json=20=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E5=85=A8=E5=B1=80usingComponents?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/WechatMpPlugin.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/plugins/WechatMpPlugin.js b/plugins/WechatMpPlugin.js index 2c9caa2..5152828 100644 --- a/plugins/WechatMpPlugin.js +++ b/plugins/WechatMpPlugin.js @@ -200,20 +200,21 @@ class OakWeChatMpPlugin { // add app.[ts/js] realPages.push('app'); + // app.json 配置全局usingComponents + await this.getComponents(components, path.join(this.basePath, 'app')); // resolve page components for (const page of pages) { let isOak = getIsOak(page); if (isOak) { - const oakPage = OakPagePath + page.replace( - new RegExp(OakPagePrefix), - 'pages' - ); + const oakPage = + OakPagePath + + page.replace(new RegExp(OakPagePrefix), 'pages'); const instance = path.resolve(process.cwd(), oakPage); if (!this.oakPages.has(oakPage)) { this.oakPages.add(oakPage); realPages.push(oakPage); } - await this.getComponents(components, instance, MODE.oak); + await this.getComponents(components, instance, MODE.oak); } else { realPages.push(page); const instance = path.resolve(this.basePath, page); @@ -252,6 +253,7 @@ class OakWeChatMpPlugin { const { usingComponents = {} } = fsExtra.readJSONSync( `${instance}.json` ); + console.log(usingComponents); const instanceDir = path.parse(instance).dir; for (const c of Object.values(usingComponents)) { if (c.indexOf('plugin://') === 0) {