fix SystemJS module formatter exporting function parameters - fixes #2681

This commit is contained in:
Sebastian McKenzie
2015-10-30 17:05:26 +00:00
parent 3a7d258c5c
commit 26cb025151
4 changed files with 20 additions and 6 deletions

View File

@@ -50,7 +50,7 @@ export default function ({ types: t }) {
return {
inherits: require("babel-plugin-transform-strict-mode"),
visitor: {
Program: {
exit(path) {
@@ -136,7 +136,13 @@ export default function ({ types: t }) {
path.replaceWith(declar);
let nodes = [];
for (let name in declar.getBindingIdentifiers()) {
let bindingIdentifiers;
if (path.isFunction()) {
bindingIdentifiers = { [declar.node.id.name]: declar.node.id };
} else {
bindingIdentifiers = declar.getBindingIdentifiers();
}
for (let name in bindingIdentifiers) {
addExportName(name, name);
nodes.push(buildExportCall(name, t.identifier(name)));
}