Handle remapping of JSXIdentifier to MemberExpression in CommonJS transform. Closes #3728 (#4763)

This commit is contained in:
Andrew Levine
2016-10-24 09:23:43 -05:00
committed by Henry Zhu
parent 7cfe5c13e3
commit de46827be7
4 changed files with 23 additions and 0 deletions

View File

@@ -59,6 +59,9 @@ export default function () {
if (path.parentPath.isCallExpression({ callee: path.node })) {
path.replaceWith(t.sequenceExpression([t.numericLiteral(0), remap]));
} else if (path.isJSXIdentifier() && t.isMemberExpression(remap)) {
const { object, property } = remap;
path.replaceWith(t.JSXMemberExpression(t.JSXIdentifier(object.name), t.JSXIdentifier(property.name)));
} else {
path.replaceWith(remap);
}