From eac4bc059d843134e477d233c1ed3a0df03a257a Mon Sep 17 00:00:00 2001 From: chaucerling Date: Mon, 31 Dec 2018 23:21:54 +0800 Subject: [PATCH] add baidu globalVar support --- src/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index 3220abd..a7b18ed 100644 --- a/src/index.js +++ b/src/index.js @@ -142,7 +142,7 @@ export default class WXAppPlugin { if (enforceTarget) { const { target } = options; - if (target !== Targets.Wechat && target !== Targets.Alipay) { + if (target !== Targets.Wechat && target !== Targets.Alipay && target !== Targets.Baidu) { options.target = Targets.Wechat; } if (!options.node || options.node.global) { @@ -403,7 +403,7 @@ export default class WXAppPlugin { const { commonModuleName } = this.options; const { target } = compilation.options; const commonChunkName = stripExt(commonModuleName); - const globalVar = target.name === 'Alipay' ? 'my' : 'wx'; + const globalVar = target.name === 'Wechat' ? 'wx' : target.name === 'Alipay' ? 'my' : 'swan'; // inject chunk entries compilation.chunkTemplate.plugin('render', (core, { name }) => {