From 6aecdfb022b03064a1eb3782983c324697682af7 Mon Sep 17 00:00:00 2001 From: Paul Gschwendtner Date: Mon, 13 Sep 2021 17:57:52 +0200 Subject: [PATCH] feat(bazel): support for terser v5 and 2020 in rollup_bundle rule (#215) * feat(bazel): support for terser v5 and 2020 in rollup_bundle rule Supports for terser v5 in the `ng_rollup_bundle` rule. currently terser fails because there is a conflicting `--beautify` CLI flag set by `@bazel/terser` and the `output` option. Instead, the new `format` name should be used: ``` ERROR: Please only specify either output or format option, preferrably format. ``` * fixup! feat(bazel): support for terser v5 and 2020 in rollup_bundle rule Make output flavor more generic in comment --- bazel/benchmark/ng_rollup_bundle/ng_rollup_bundle.bzl | 8 ++++---- bazel/benchmark/ng_rollup_bundle/terser_config.json | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bazel/benchmark/ng_rollup_bundle/ng_rollup_bundle.bzl b/bazel/benchmark/ng_rollup_bundle/ng_rollup_bundle.bzl index 52001406a..762fcef3a 100644 --- a/bazel/benchmark/ng_rollup_bundle/ng_rollup_bundle.bzl +++ b/bazel/benchmark/ng_rollup_bundle/ng_rollup_bundle.bzl @@ -24,10 +24,10 @@ def ng_rollup_bundle( Runs [rollup], [terser_minified] and [brotli] to produce a number of output bundles. - es2015 : "%{name}.js" - es2015 minified : "%{name}.min.js" - es2015 minified (compressed) : "%{name}.min.js.br", - es2015 minified (debug) : "%{name}.min_debug.js" + JS : "%{name}.js" + JS minified : "%{name}.min.js" + JS minified (compressed) : "%{name}.min.js.br", + JS minified (debug) : "%{name}.min_debug.js" It registers `@angular-devkit/build-optimizer` as a rollup plugin by default. This helps with further optimization. See https://github.com/angular/angular-cli/tree/master/packages/angular_devkit/build_optimizer. diff --git a/bazel/benchmark/ng_rollup_bundle/terser_config.json b/bazel/benchmark/ng_rollup_bundle/terser_config.json index dd2c2a283..187c6eee4 100644 --- a/bazel/benchmark/ng_rollup_bundle/terser_config.json +++ b/bazel/benchmark/ng_rollup_bundle/terser_config.json @@ -1,6 +1,6 @@ { - "output": { - "ecma": "es2015", + "format": { + "ecma": "es2020", "comments": false, "beautify": "bazel_debug" },