diff --git a/lib/6to5/modules/common.js b/lib/6to5/modules/common.js index 0fbb851c7c..551968768c 100644 --- a/lib/6to5/modules/common.js +++ b/lib/6to5/modules/common.js @@ -39,10 +39,17 @@ CommonJSFormatter.prototype.export = function (node, nodes) { var declar = node.declaration; if (node.default) { - t.ensureExpressionType(declar); + var ref = declar; + + if (t.isClass(ref) || t.isFunction(ref)) { + if (ref.id) { + nodes.push(ref); + ref = ref.id; + } + } nodes.push(util.template("exports-default", { - VALUE: declar + VALUE: ref }, true)); } else { var id = declar.id;