Skip to content

Commit

Permalink
fix(cli): 修复部分场景 wx 不能替换成 Taro 的问题,close #3941
Browse files Browse the repository at this point in the history
  • Loading branch information
luckyadam committed Jul 25, 2019
1 parent 98fad95 commit 8153221
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions packages/taro-cli/src/convertor/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
})
Expand Down

0 comments on commit 8153221

Please sign in to comment.