aspect-build/rules_js

[Bug]: use of bzlmod repo_name causes error

jbedard opened this issue · 2 comments

What happened?

Does not work with bazel_dep(repo_name)

Version

bazel 7
rules_js 1.41.1

How to reproduce

Use the bzlmod repo_name feature:

bazel_dep(name = "aspect_rules_js", version = "1.41.1", repo_name = "foo")

and any target in a BUILD that loads from there:

load("@foo//npm:defs.bzl", "npm_package")

npm_package(
    name = "foo_pkg",
    srcs = ["file.txt"],
    visibility = ["//visibility:public"]
)
ERROR: no such package '@@[unknown repo 'aspect_rules_js' requested from @@]//npm': The repository '@@[unknown repo 'aspect_rules_js' requested from @@]' could not be resolved: No repository visible as '@aspect_rules_js' from main repository
ERROR: /.../rules_js-repo_name/BUILD.bazel:3:12: errors encountered resolving select() keys for //:foo_pkg_files
ERROR: Analysis of target '//:foo_pkg' failed; build aborted: Analysis failed
INFO: Elapsed time: 3.500s, Critical Path: 0.02s
INFO: 1 process: 1 internal.
ERROR: Build did NOT complete successfully
FAILED: 

May be the same as/caused-by #1343

This seems to be a subset of #1343 only applying to bzlmod, while #1343 also has issues with repository rules.