Skip to content

Commit

Permalink
build(devtools): target es2020 explicitly (angular#50086)
Browse files Browse the repository at this point in the history
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.

PR Close angular#50086
  • Loading branch information
AleksanderBodurri authored and sumitparakh committed May 18, 2023
1 parent 0fbb7c1 commit 81b2836
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
14 changes: 12 additions & 2 deletions devtools/projects/shell-browser/src/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,12 @@ esbuild(
minify = True,
platform = "browser",
splitting = False,
target = "esnext",
# todo(aleksanderbodurri): here we target es2020 explicitly.
# We do this because of a bug caused by https://github.com/evanw/esbuild/issues/2950 and an Angular v16 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.
target = "es2020",
deps = LINKER_PROCESSED_FW_PACKAGES + [":src"],
)

Expand All @@ -76,7 +81,12 @@ esbuild(
minify = True,
platform = "browser",
splitting = False,
target = "esnext",
# todo(aleksanderbodurri): here we target es2020 explicitly.
# We do this because of a bug caused by https://github.com/evanw/esbuild/issues/2950 and an Angular v16 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.
target = "es2020",
deps = [":devtools"],
)

Expand Down
7 changes: 6 additions & 1 deletion devtools/src/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,12 @@ esbuild(
entry_points = [":main.ts"],
platform = "browser",
splitting = True,
target = "es2016",
# todo(aleksanderbodurri): here we target es2020 explicitly.
# We do this because of a bug caused by https://github.com/evanw/esbuild/issues/2950 and an Angular v16 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.
target = "es2020",
deps = LINKER_PROCESSED_FW_PACKAGES + [":demo"],
)

Expand Down

0 comments on commit 81b2836

Please sign in to comment.