diff --git a/lib/6to5/file.js b/lib/6to5/file.js index d2888b199b..c4764c3a1b 100644 --- a/lib/6to5/file.js +++ b/lib/6to5/file.js @@ -300,7 +300,8 @@ File.prototype.parse = function (code) { code = this.addCode(code); var opts = this.opts; - opts.looseModules = this.isLoose("modules"); + + opts.allowImportExportEverywhere = this.isLoose("modules"); return util.parse(opts, code, function (tree) { self.transform(tree); @@ -337,6 +338,7 @@ File.prototype.generate = function () { var result = { code: "", + opts: opts, map: null, ast: null }; diff --git a/lib/6to5/util.js b/lib/6to5/util.js index c5b33284be..dc77192d81 100644 --- a/lib/6to5/util.js +++ b/lib/6to5/util.js @@ -222,7 +222,7 @@ exports.parse = function (opts, code, callback) { var tokens = []; var ast = acorn.parse(code, { - allowImportExportEverywhere: opts.looseModules, + allowImportExportEverywhere: opts.allowImportExportEverywhere, allowReturnOutsideFunction: true, ecmaVersion: opts.experimental ? 7 : 6, playground: opts.playground,