enable --module by default (#5738)

- fix corner case in `mangle`
This commit is contained in:
Alex Lam S.L
2022-11-21 18:25:34 +00:00
committed by GitHub
parent 21aff996a5
commit 68d62a8a31
17 changed files with 294 additions and 92 deletions

View File

@@ -108,7 +108,8 @@ function process_option(name, no_value) {
" --ie Support non-standard Internet Explorer.",
" --keep-fargs Do not mangle/drop function arguments.",
" --keep-fnames Do not mangle/drop function names. Useful for code relying on Function.prototype.name.",
" --module Process input as ES module (implies --toplevel)",
" --module Process input as ES module (implies --toplevel).",
" --no-module Process input with improved JavaScript compatibility.",
" --name-cache <file> File to hold mangled name mappings.",
" --rename Force symbol expansion.",
" --no-rename Disable symbol expansion.",
@@ -155,7 +156,6 @@ function process_option(name, no_value) {
case "expression":
case "ie":
case "ie8":
case "module":
case "timings":
case "toplevel":
case "v8":
@@ -201,6 +201,12 @@ function process_option(name, no_value) {
if (typeof options.mangle != "object") options.mangle = {};
options.mangle.properties = parse_js(read_value(), options.mangle.properties);
break;
case "module":
options.module = true;
break;
case "no-module":
options.module = false;
break;
case "name-cache":
nameCache = read_value(true);
options.nameCache = JSON.parse(read_file(nameCache, "{}"));