Skip to content

Commit 3d3faec

Browse files
build(devtools): target es2020 explicitly
We do this because of a bug caused by evanw/esbuild#2950 and a recent change to how angular static properties are attached to class constructors. Targeting esnext or es2022 will cause the static initializer blocks that attach these static properties on class constructors to reference a class constructor variable that they do not have access to. Because of this we explicitly target es2020 in our Angular DevTools builds.
1 parent df30710 commit 3d3faec

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

devtools/projects/shell-browser/src/BUILD.bazel

+12-2
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,12 @@ esbuild(
6464
minify = True,
6565
platform = "browser",
6666
splitting = False,
67-
target = "esnext",
67+
# todo(aleksanderbodurri): here we target es2020 explicitly.
68+
# We do this because of a bug caused by https://github.com/evanw/esbuild/issues/2950 and an Angular v16 change
69+
# to how angular static properties are attached to class constructors.
70+
# Targeting esnext or es2022 will cause the static initializer blocks that attach these static properties on class
71+
# constructors to reference a class constructor variable that they do not have access to.
72+
target = "es2020",
6873
deps = LINKER_PROCESSED_FW_PACKAGES + [":src"],
6974
)
7075

@@ -76,7 +81,12 @@ esbuild(
7681
minify = True,
7782
platform = "browser",
7883
splitting = False,
79-
target = "esnext",
84+
# todo(aleksanderbodurri): here we target es2020 explicitly.
85+
# We do this because of a bug caused by https://github.com/evanw/esbuild/issues/2950 and an Angular v16 change
86+
# to how angular static properties are attached to class constructors.
87+
# Targeting esnext or es2022 will cause the static initializer blocks that attach these static properties on class
88+
# constructors to reference a class constructor variable that they do not have access to.
89+
target = "es2020",
8090
deps = [":devtools"],
8191
)
8292

devtools/src/BUILD.bazel

+6-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,12 @@ esbuild(
4545
entry_points = [":main.ts"],
4646
platform = "browser",
4747
splitting = True,
48-
target = "es2016",
48+
# todo(aleksanderbodurri): here we target es2020 explicitly.
49+
# We do this because of a bug caused by https://github.com/evanw/esbuild/issues/2950 and an Angular v16 change
50+
# to how angular static properties are attached to class constructors.
51+
# Targeting esnext or es2022 will cause the static initializer blocks that attach these static properties on class
52+
# constructors to reference a class constructor variable that they do not have access to.
53+
target = "es2020",
4954
deps = LINKER_PROCESSED_FW_PACKAGES + [":demo"],
5055
)
5156

0 commit comments

Comments
 (0)