build: add ngJitMode to ng_rollup_bundle terser config (#33773)

This adds a `tools/ng_rollup_bundle/terser_config.json` file to override the default terser_minified config provided by the rule. After this change, the layer violation in rules_nodejs can be fixed by removing `"global_defs": {"ngDevMode": false, "ngI18nClosureMode": false},` from `terser_config.default.json` in rules_nodejs.

Change requested by Alex Rickabaugh in https://github.com/bazelbuild/rules_nodejs/pull/1338.

PR Close #33773
This commit is contained in:
Greg Magolan 2019-11-12 13:12:45 -08:00 committed by Alex Rickabaugh
parent b90aac0d43
commit c89eed56b6
3 changed files with 17 additions and 1 deletions

View File

@ -2,7 +2,10 @@ package(default_visibility = ["//visibility:public"])
load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary")
exports_files(["rollup.config.js"])
exports_files([
"rollup.config.js",
"terser_config.json",
])
nodejs_binary(
name = "rollup_with_build_optimizer",

View File

@ -391,6 +391,7 @@ def ng_rollup_bundle(name, **kwargs):
# maintain the comments off behavior. We pass the --comments flag with
# a regex that always evaluates to false to do this.
"args": ["--comments", "/bogus_string_to_suppress_all_comments^/"],
"config_file": "//tools/ng_rollup_bundle:terser_config.json",
"sourcemap": False,
}

View File

@ -0,0 +1,12 @@
{
"compress": {
"global_defs": {"ngDevMode": false, "ngI18nClosureMode": false, "ngJitMode": false},
"keep_fnames": "bazel_no_debug",
"passes": 3,
"pure_getters": true,
"reduce_funcs": "bazel_no_debug",
"reduce_vars": "bazel_no_debug",
"sequences": "bazel_no_debug"
},
"mangle": "bazel_no_debug"
}