expose dynamicImports when es6.modules is blacklisted babel/ember-cli-babel#24

This commit is contained in:
Sebastian McKenzie 2015-03-07 03:31:24 +11:00
parent 9e1874ba89
commit d32f587e3c
2 changed files with 7 additions and 3 deletions

View File

@ -339,7 +339,11 @@ export default class File {
this.dynamicImported.push(declar);
if (noDefault) this.dynamicImportedNoDefault.push(declar);
this.moduleFormatter.importSpecifier(specifiers[0], declar, this.dynamicImports);
if (this.transformers["es6.modules"].canRun()) {
this.moduleFormatter.importSpecifier(specifiers[0], declar, this.dynamicImports);
} else {
this.dynamicImports.push(declar);
}
}
return id;

View File

@ -1,12 +1,12 @@
import * as strict from "../../helpers/strict";
export function Program(program, parent, scope, file) {
if (!file.transformers["es6.modules"].canRun()) return;
strict.wrap(program, function () {
program.body = file.dynamicImports.concat(program.body);
});
if (!file.transformers["es6.modules"].canRun()) return;
if (file.moduleFormatter.transform) {
file.moduleFormatter.transform(program);
}