Skip to content

Commit

Permalink
Handle remapping of JSXIdentifier to MemberExpression in CommonJS tra…
Browse files Browse the repository at this point in the history
…nsform. Closes #3728 (#4763)
  • Loading branch information
DrewML authored and hzoo committed Oct 24, 2016
1 parent 7cfe5c1 commit de46827
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 0 deletions.
Expand Up @@ -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);
}
Expand Down
@@ -0,0 +1,2 @@
import { Modal } from "react-bootstrap";
export default CustomModal = () => <Modal.Header>foobar</Modal.Header>;
@@ -0,0 +1,9 @@
"use strict";

Object.defineProperty(exports, "__esModule", {
value: true
});

var _reactBootstrap = require("react-bootstrap");

exports.default = CustomModal = () => babelHelpers.jsx(_reactBootstrap.Modal.Header, {}, void 0, "foobar");
@@ -0,0 +1,9 @@
{
"plugins": [
"external-helpers",
"syntax-jsx",
"transform-react-inline-elements",
"transform-react-jsx",
"transform-es2015-modules-commonjs"
]
}

0 comments on commit de46827

Please sign in to comment.