From 8157ed9a5840be69e9a3d4a4c77a6ddbfe8f81d0 Mon Sep 17 00:00:00 2001 From: yuche Date: Fri, 16 Aug 2019 14:38:14 +0800 Subject: [PATCH] =?UTF-8?q?fix(transformer):=20=E8=BD=AC=E6=8D=A2=E6=89=80?= =?UTF-8?q?=E6=9C=89=E5=90=8D=E4=B8=BA=20wx=20=E7=9A=84=E5=BC=95=E7=94=A8?= =?UTF-8?q?=E5=9E=8B=E6=A0=87=E8=AF=86=E7=AC=A6=EF=BC=8Cclose=20#3953?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/taroize/src/script.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/taroize/src/script.ts b/packages/taroize/src/script.ts index 7690b9fecb23..9b1946296b86 100644 --- a/packages/taroize/src/script.ts +++ b/packages/taroize/src/script.ts @@ -34,6 +34,11 @@ export function parseScript ( BlockStatement (path) { path.scope.rename('wx', 'Taro') }, + Identifier (path) { + if (path.isReferenced() && path.node.name === 'wx') { + path.replaceWith(t.identifier('Taro')) + } + }, CallExpression (path) { const callee = path.get('callee') if (callee.isIdentifier()) {