Ensure default exported classes keep entry in export table (#5488)

This commit is contained in:
Brian Ng
2017-04-09 18:39:15 -05:00
committed by Logan Smyth
parent 769eddc788
commit cd9bb7ba10
13 changed files with 20 additions and 6 deletions

View File

@@ -17,7 +17,10 @@ export default function ({ types: t }) {
// Split the class declaration and the export into two separate statements.
path.replaceWith(node.declaration);
path.insertAfter(t.exportDefaultDeclaration(ref));
path.insertAfter(t.exportNamedDeclaration(
null,
[t.exportSpecifier(ref, t.identifier("default"))]
));
},
ClassDeclaration(path) {

View File

@@ -3,6 +3,7 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _net = require('net');

View File

@@ -3,6 +3,7 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _BaseFoo2 = require('./BaseFoo');

View File

@@ -3,6 +3,7 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _react = require('react');

View File

@@ -0,0 +1 @@
export default class Foo {}

View File

@@ -0,0 +1,5 @@
var Foo = function Foo() {
babelHelpers.classCallCheck(this, Foo);
};
export { Foo as default };

View File

@@ -9,4 +9,4 @@ var _class = function (_A) {
return _class;
}(A);
export default _class;
export { _class as default };