build: fix app_bundle rule after migrating packages/compiler (#61566)

The `app_bundle` rule does not work after the migration of
`packages/compiler` to `ts_project` because the `.mjs` extensions are
now missing in the non npm-package output.

This causes runtime errors as `.js` is not recognized as ESM. Switching
to the real npm package for usage, fixes this issue.

PR Close #61566
This commit is contained in:
Paul Gschwendtner 2025-05-21 11:35:50 +00:00 committed by kirjs
parent 87f440bb77
commit 7bc39a883d
3 changed files with 10 additions and 3 deletions

View file

@ -1,4 +1,4 @@
load("//tools:defaults.bzl", "ng_package", "tsec_test")
load("//tools:defaults.bzl", "ng_package", "pkg_npm", "tsec_test")
load("//tools:defaults2.bzl", "npm_package", "ts_project")
package(default_visibility = ["//visibility:public"])
@ -57,6 +57,14 @@ npm_package(
},
)
# TODO(devversion): Temporary linkable `pkg_npm` for making compiler usable with the rules_nodejs linker.
# Long-term, `pkg_npm` will be migrated to `npm_package` in general.
pkg_npm(
name = "linkable_npm_package",
package_name = "@angular/compiler",
nested_packages = [":npm_package"],
)
filegroup(
name = "files_for_docgen",
srcs = glob([

View file

@ -46,7 +46,6 @@ ts_project(
jasmine_node_test(
name = "test",
data = [
":bundle",
":bundle.debug.min.js",
":bundle.js",
":bundle.min.js",

View file

@ -43,7 +43,7 @@ index d6249b8..707ae39 100755
config_file = ":%s_config_file" % name,
deps = [
- "@npm//@angular/compiler-cli",
+ "@angular//packages/compiler:npm_package",
+ "@angular//packages/compiler:linkable_npm_package",
+ "@angular//packages/compiler-cli:npm_package",
"@npm//@angular/build-tooling/shared-scripts/angular-optimization:js_lib",
],