From 6e9be5486cd9e2060f2b179fdeaa7d21bc52bc10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio=20Santos?= Date: Mon, 19 Mar 2018 16:43:10 +0000 Subject: [PATCH] pass module option to parse as well. --- lib/minify.js | 2 +- lib/parse.js | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/minify.js b/lib/minify.js index a4b74f1c..e360da01 100644 --- a/lib/minify.js +++ b/lib/minify.js @@ -77,7 +77,7 @@ function minify(files, options) { set_shorthand("ie8", options, [ "compress", "mangle", "output" ]); set_shorthand("keep_classnames", options, [ "compress", "mangle" ]); set_shorthand("keep_fnames", options, [ "compress", "mangle" ]); - set_shorthand("module", options, [ "compress", "mangle" ]); + set_shorthand("module", options, [ "parse", "compress", "mangle" ]); set_shorthand("safari10", options, [ "mangle", "output" ]); set_shorthand("toplevel", options, [ "compress", "mangle" ]); set_shorthand("warnings", options, [ "compress" ]); diff --git a/lib/parse.js b/lib/parse.js index d8cc9ac4..bd2434ad 100644 --- a/lib/parse.js +++ b/lib/parse.js @@ -859,6 +859,7 @@ function parse($TEXT, options) { expression : false, filename : null, html5_comments : true, + module : false, shebang : true, strict : false, toplevel : null, @@ -2913,6 +2914,7 @@ function parse($TEXT, options) { var start = S.token; var body = []; S.input.push_directives_stack(); + if (options.module) S.input.add_directive("use strict"); while (!is("eof")) body.push(statement()); S.input.pop_directives_stack();