From 815322196b250476732a9043dd69f346ca890bd1 Mon Sep 17 00:00:00 2001 From: luckyadam Date: Thu, 25 Jul 2019 11:19:08 +0800 Subject: [PATCH] =?UTF-8?q?fix(cli):=20=E4=BF=AE=E5=A4=8D=E9=83=A8?= =?UTF-8?q?=E5=88=86=E5=9C=BA=E6=99=AF=20wx=20=E4=B8=8D=E8=83=BD=E6=9B=BF?= =?UTF-8?q?=E6=8D=A2=E6=88=90=20Taro=20=E7=9A=84=E9=97=AE=E9=A2=98?= =?UTF-8?q?=EF=BC=8Cclose=20#3941?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/taro-cli/src/convertor/index.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/packages/taro-cli/src/convertor/index.ts b/packages/taro-cli/src/convertor/index.ts index ddd74cf2ad8c..8c79c41edbf1 100644 --- a/packages/taro-cli/src/convertor/index.ts +++ b/packages/taro-cli/src/convertor/index.ts @@ -235,12 +235,15 @@ export default class Convertor { ) needInsertImportTaro = true } - } else if (callee.type === 'MemberExpression') { - const object = callee.object as t.Identifier - if (object.name === 'wx') { - (calleePath.get('object') as NodePath).replaceWith(t.identifier('Taro')) - needInsertImportTaro = true - } + } + }, + + MemberExpression (astPath) { + const node = astPath.node + const object = node.object + if (t.isIdentifier(object) && object.name === 'wx') { + node.object = t.identifier('Taro') + needInsertImportTaro = true } } })