diff --git a/lib/6to5/transformation/modules/amd.js b/lib/6to5/transformation/modules/amd.js index 0eb61407b2..6d06ddbe46 100644 --- a/lib/6to5/transformation/modules/amd.js +++ b/lib/6to5/transformation/modules/amd.js @@ -87,7 +87,11 @@ AMDFormatter.prototype.importSpecifier = function (specifier, node, nodes) { var key = t.getSpecifierName(specifier); var ref = this._push(node); - if (t.isImportBatchSpecifier(specifier) || _.contains(this.file.dynamicImports, node)) { + if (_.contains(this.file.dynamicImports, node)) { + // Prevent unnecessary renaming of dynamic imports. + this.ids[node.source.value] = key; + return; + } else if (t.isImportBatchSpecifier(specifier)) { // import * as bar from "foo"; } else if (t.isSpecifierDefault(specifier) && !this.noInteropRequire) { // import foo from "foo"; diff --git a/test/fixtures/transformation/optional-self-contained/runtime-amd/expected.js b/test/fixtures/transformation/optional-self-contained/runtime-amd/expected.js index 17b753e8c5..928902ba02 100644 --- a/test/fixtures/transformation/optional-self-contained/runtime-amd/expected.js +++ b/test/fixtures/transformation/optional-self-contained/runtime-amd/expected.js @@ -1,8 +1,5 @@ -define(["exports", "6to5-runtime/6to5", "6to5-runtime/core-js", "6to5-runtime/regenerator", "someModule"], function (exports, _to5Runtime6to5, _to5RuntimeCoreJs, _to5RuntimeRegenerator, _someModule) { +define(["exports", "6to5-runtime/6to5", "6to5-runtime/core-js", "6to5-runtime/regenerator", "someModule"], function (exports, _to5Runtime, _core, _regeneratorRuntime, _someModule) { "use strict"; - var _to5Runtime = _to5Runtime6to5; - var _core = _to5RuntimeCoreJs; - var _regeneratorRuntime = _to5RuntimeRegenerator; var foo = _to5Runtime.interopRequire(_someModule); });