diff --git a/examples/angular_view_engine/patches/@angular+bazel+9.0.5.patch b/examples/angular_view_engine/patches/@angular+bazel+9.0.5.patch index c6a1fa7822..e1ed83dd32 100644 --- a/examples/angular_view_engine/patches/@angular+bazel+9.0.5.patch +++ b/examples/angular_view_engine/patches/@angular+bazel+9.0.5.patch @@ -811,7 +811,7 @@ index 32b640a..a787bbb 100755 node_modules_aspect = _node_modules_aspect diff --git a/node_modules/@angular/bazel/src/ng_module.bzl b/node_modules/@angular/bazel/src/ng_module.bzl -index a38f6a8..436d83b 100755 +index a38f6a8..0bd569d 100755 --- a/node_modules/@angular/bazel/src/ng_module.bzl +++ b/node_modules/@angular/bazel/src/ng_module.bzl @@ -13,6 +13,7 @@ load( @@ -822,14 +822,15 @@ index a38f6a8..436d83b 100755 "NpmPackageInfo", "TsConfigInfo", "compile_ts", -@@ -629,6 +630,14 @@ def _ng_module_impl(ctx): +@@ -629,6 +630,15 @@ def _ng_module_impl(ctx): # once it is no longer needed. ]) -+ if ctx.attr.module_name: ++ if ctx.attr.package_name: + path = "/".join([p for p in [ctx.bin_dir.path, ctx.label.workspace_root, ctx.label.package] if p]) + ts_providers["providers"].append(LinkablePackageInfo( -+ package_name = ctx.attr.module_name, ++ package_name = ctx.attr.package_name, ++ package_path = ctx.attr.package_path, + path = path, + files = ts_providers["typescript"]["es5_sources"], + )) @@ -837,6 +838,15 @@ index a38f6a8..436d83b 100755 return ts_providers_dict_to_struct(ts_providers) local_deps_aspects = [node_modules_aspect, _collect_summaries_aspect] +@@ -750,6 +760,8 @@ NG_MODULE_RULE_ATTRS = dict(dict(COMMON_ATTRIBUTES, **NG_MODULE_ATTRIBUTES), **{ + default = Label("@npm//typescript:typescript__typings"), + ), + "entry_point": attr.label(allow_single_file = True), ++ "package_name": attr.string(), ++ "package_path": attr.string(), + + # Default is %{name}_public_index + # The suffix points to the generated "bundle index" files that users import from diff --git a/node_modules/@angular/bazel/src/ng_package/ng_package.bzl b/node_modules/@angular/bazel/src/ng_package/ng_package.bzl index db33ad3..0079446 100755 --- a/node_modules/@angular/bazel/src/ng_package/ng_package.bzl diff --git a/examples/angular_view_engine/src/lib/typography/BUILD.bazel b/examples/angular_view_engine/src/lib/typography/BUILD.bazel index ea3ae26610..fa41e67508 100644 --- a/examples/angular_view_engine/src/lib/typography/BUILD.bazel +++ b/examples/angular_view_engine/src/lib/typography/BUILD.bazel @@ -6,6 +6,7 @@ ng_module( name = "typography", srcs = glob(["*.ts"]), module_name = "@examples/angular/typography", + package_name = "@examples/angular/typography", tsconfig = "//src:tsconfig.json", deps = [ "@npm//@angular/core", diff --git a/internal/linker/link_node_modules.bzl b/internal/linker/link_node_modules.bzl index 280312ad7d..bfe906171f 100644 --- a/internal/linker/link_node_modules.bzl +++ b/internal/linker/link_node_modules.bzl @@ -157,7 +157,8 @@ def _get_module_mappings(target, ctx): _debug(ctx.var, "No package_name in LinkablePackageInfo for", target.label) return mappings - map_key = "%s:%s" % (linkable_package_info.package_name, linkable_package_info.package_path) + package_path = linkable_package_info.package_path if hasattr(linkable_package_info, "package_path") else "" + map_key = "%s:%s" % (linkable_package_info.package_name, package_path) map_value = linkable_package_info.path if _link_mapping(target.label, mappings, map_key, map_value):