Skip to content

Commit

Permalink
build: switch from rollup and terser to esbuild for creating contract…
Browse files Browse the repository at this point in the history
… 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
  • Loading branch information
alan-agius4 authored and atscott committed May 13, 2024
1 parent 0cb5031 commit ef029b8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 34 deletions.
2 changes: 1 addition & 1 deletion packages/core/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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 $< $@",
)
25 changes: 12 additions & 13 deletions packages/core/primitives/event-dispatch/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -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"])

Expand Down Expand Up @@ -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,
)
20 changes: 0 additions & 20 deletions packages/core/primitives/event-dispatch/terser.config.json

This file was deleted.

0 comments on commit ef029b8

Please sign in to comment.