diff --git a/lib/6to5/generation/generators/modules.js b/lib/6to5/generation/generators/modules.js index 6e8a587efb..16cff50fcc 100644 --- a/lib/6to5/generation/generators/modules.js +++ b/lib/6to5/generation/generators/modules.js @@ -4,8 +4,8 @@ var t = require("../../types"); var _ = require("lodash"); exports.ImportSpecifier = function (node, print) { - if (node.id && node.id.name === "default") { - print(node.name); + if (t.isSpecifierDefault(node)) { + print(t.getSpecifierName(node)); } else { return exports.ExportSpecifier.apply(this, arguments); } @@ -71,7 +71,7 @@ exports.ImportDeclaration = function (node, print) { self.push(", "); } - var isDefault = spec.id && spec.id.name === "default"; + var isDefault = t.isSpecifierDefault(spec); if (!isDefault && spec.type !== "ImportBatchSpecifier" && !foundImportSpecifier) { foundImportSpecifier = true;