Skip to content

Commit 9d1acd6

Browse files
alan-agius4atscott
authored andcommitted
build: switch from rollup and terser to esbuild for creating contract bundle (angular#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 angular#55705
1 parent dc0c55c commit 9d1acd6

File tree

3 files changed

+13
-34
lines changed

3 files changed

+13
-34
lines changed

packages/core/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,5 +148,5 @@ genrule(
148148
name = "event_dispatch_contract_binary",
149149
srcs = ["//packages/core/primitives/event-dispatch:contract_bundle_min"],
150150
outs = ["event-dispatch-contract.min.js"],
151-
cmd = "cat $< >> $@",
151+
cmd = "cp $< $@",
152152
)

packages/core/primitives/event-dispatch/BUILD.bazel

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
load("//tools:defaults.bzl", "ts_library", "tsec_test")
2-
load("@npm//@bazel/rollup:index.bzl", "rollup_bundle")
3-
load("@npm//@bazel/terser:index.bzl", "terser_minified")
1+
load("//tools:defaults.bzl", "esbuild", "ts_library", "tsec_test")
42

53
package(default_visibility = ["//visibility:public"])
64

@@ -29,17 +27,18 @@ filegroup(
2927
visibility = ["//visibility:public"],
3028
)
3129

32-
rollup_bundle(
33-
name = "contract_bundle",
34-
args = ["--no-sourcemap"],
30+
esbuild(
31+
name = "contract_bundle_min",
32+
args = {
33+
"sourcemap": False,
34+
"resolveExtensions": [
35+
".mjs",
36+
],
37+
"legalComments": "none",
38+
},
3539
entry_point = ":contract_binary.ts",
3640
format = "iife",
41+
minify = True,
42+
sourcemap = "inline",
3743
deps = [":event-dispatch"],
3844
)
39-
40-
terser_minified(
41-
name = "contract_bundle_min",
42-
src = ":contract_bundle",
43-
config_file = ":terser.config.json",
44-
sourcemap = False,
45-
)

packages/core/primitives/event-dispatch/terser.config.json

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)