diff --git a/lib/6to5/file.js b/lib/6to5/file.js index 3cd89c2cf7..1780dff724 100644 --- a/lib/6to5/file.js +++ b/lib/6to5/file.js @@ -316,6 +316,7 @@ File.prototype.parse = function (code) { var opts = this.opts; opts.allowImportExportEverywhere = this.isLoose("es6.modules"); + opts.strictMode = this.transformers.useStrict.canRun(); return util.parse(opts, code, function (tree) { self.transform(tree); diff --git a/lib/6to5/util.js b/lib/6to5/util.js index fcb560ebe6..939148f257 100644 --- a/lib/6to5/util.js +++ b/lib/6to5/util.js @@ -204,7 +204,7 @@ exports.parse = function (opts, code, callback) { allowReturnOutsideFunction: true, ecmaVersion: opts.experimental ? 7 : 6, playground: opts.playground, - strictMode: true, + strictMode: opts.strictMode, onComment: comments, locations: true, onToken: tokens,