Merge pull request #3391 from benjamn/fix-buildExportAll

Make buildExportAll generate pure ES5 code.
This commit is contained in:
Amjad Masad
2016-03-02 18:50:47 -08:00
6 changed files with 30 additions and 49 deletions

View File

@@ -32,16 +32,15 @@ let buildExportsAssignment = template(`
`);
let buildExportAll = template(`
for (let KEY in OBJECT) {
if (KEY === "default") continue;
Object.defineProperty(exports, KEY, {
Object.keys(OBJECT).forEach(function (key) {
if (key === "default") return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
return OBJECT[KEY];
return OBJECT[key];
}
});
}
});
`);
const THIS_BREAK_KEYS = ["FunctionExpression", "FunctionDeclaration", "ClassProperty", "ClassMethod", "ObjectMethod"];
@@ -335,7 +334,6 @@ export default function () {
}
} else if (path.isExportAllDeclaration()) {
topNodes.push(buildExportAll({
KEY: path.scope.generateUidIdentifier("key"),
OBJECT: addRequire(path.node.source.value, path.node._blockHoist)
}));
path.remove();