Skip to content

Commit 00bcd77

Browse files
committed
build: ensure esbuild nodejs_binary correctly wires up ESM loader (angular#48521)
ESBuild relies on the linker and we currently set up the ESM loader, along with accidentally enabling the patched resolution loader. This didn't cause any problems in sandbox, but outside of sandbox incorrect ESBuild versions may be discovered because the loader looks at the top-level `npm/` node modules before looking relative to e.g. `@bazel/esbuild` PR Close angular#48521
1 parent cc5d3b7 commit 00bcd77

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tools/esm-interop/patches/npm/@bazel+esbuild+5.7.1.patch

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ index 7d84b1d..d008b4b 100755
66
-exports_files(["launcher.js"])
77
+exports_files(["launcher.mjs"])
88
diff --git a/node_modules/@bazel/esbuild/esbuild.bzl b/node_modules/@bazel/esbuild/esbuild.bzl
9-
index 9600076..5a69c8d 100755
9+
index 9600076..8a0cace 100755
1010
--- a/node_modules/@bazel/esbuild/esbuild.bzl
1111
+++ b/node_modules/@bazel/esbuild/esbuild.bzl
1212
@@ -4,7 +4,7 @@ esbuild rule
@@ -18,12 +18,13 @@ index 9600076..5a69c8d 100755
1818
load("@build_bazel_rules_nodejs//:providers.bzl", "ExternalNpmPackageInfo", "JSEcmaScriptModuleInfo", "node_modules_aspect", "run_node")
1919
load("@build_bazel_rules_nodejs//internal/linker:link_node_modules.bzl", "LinkerPackageMappingInfo", "module_mappings_aspect")
2020
load("@build_bazel_rules_nodejs//internal/common:expand_variables.bzl", "expand_variables")
21-
@@ -420,7 +420,7 @@ def esbuild_macro(name, output_dir = False, splitting = False, **kwargs):
21+
@@ -420,7 +420,8 @@ def esbuild_macro(name, output_dir = False, splitting = False, **kwargs):
2222
_launcher = "_%s_esbuild_launcher" % name
2323
nodejs_binary(
2424
name = _launcher,
2525
- entry_point = Label("//@bazel/esbuild:launcher.js"),
2626
+ entry_point = Label("//@bazel/esbuild:launcher.mjs"),
27+
+ linker_enabled = True,
2728
)
2829

2930
srcs = kwargs.pop("srcs", [])

0 commit comments

Comments
 (0)