mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
build: switch from rollup and terser to esbuild for creating contract bundle (#55705)
This commit implements the replacement of rollup and terser with esbuild for generating the contract_bundle binary. The transition is facilitated by optimizations aimed at reducing the bundle size. PR Close #55705
This commit is contained in:
@@ -148,5 +148,5 @@ genrule(
|
||||
name = "event_dispatch_contract_binary",
|
||||
srcs = ["//packages/core/primitives/event-dispatch:contract_bundle_min"],
|
||||
outs = ["event-dispatch-contract.min.js"],
|
||||
cmd = "cat $< >> $@",
|
||||
cmd = "cp $< $@",
|
||||
)
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
load("//tools:defaults.bzl", "ts_library", "tsec_test")
|
||||
load("@npm//@bazel/rollup:index.bzl", "rollup_bundle")
|
||||
load("@npm//@bazel/terser:index.bzl", "terser_minified")
|
||||
load("//tools:defaults.bzl", "esbuild", "ts_library", "tsec_test")
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
@@ -29,17 +27,18 @@ filegroup(
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
rollup_bundle(
|
||||
name = "contract_bundle",
|
||||
args = ["--no-sourcemap"],
|
||||
esbuild(
|
||||
name = "contract_bundle_min",
|
||||
args = {
|
||||
"sourcemap": False,
|
||||
"resolveExtensions": [
|
||||
".mjs",
|
||||
],
|
||||
"legalComments": "none",
|
||||
},
|
||||
entry_point = ":contract_binary.ts",
|
||||
format = "iife",
|
||||
minify = True,
|
||||
sourcemap = "inline",
|
||||
deps = [":event-dispatch"],
|
||||
)
|
||||
|
||||
terser_minified(
|
||||
name = "contract_bundle_min",
|
||||
src = ":contract_bundle",
|
||||
config_file = ":terser.config.json",
|
||||
sourcemap = False,
|
||||
)
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
{
|
||||
"ecma": "es2020",
|
||||
"compress": {
|
||||
"toplevel": true,
|
||||
"passes": 2,
|
||||
"pure_getters": true
|
||||
},
|
||||
"mangle": {
|
||||
"toplevel": true,
|
||||
"properties": false,
|
||||
"keep_classnames": false,
|
||||
"keep_fnames": false
|
||||
},
|
||||
"format": {
|
||||
"ecma": "es2020",
|
||||
"ascii_only": true,
|
||||
"wrap_func_args": false,
|
||||
"comments": false
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user