aspect-build / aspect-build/rules_js
Error message not helpful when virtual store not linked
- Dominant language
- Starlark
- Stars
- 378
- Forks
- 183
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 32
Description
### What happened?
Hey,
I've been trying out the new ts_proto_library (very excited to use it), and quite likely I'm missing something, but figured I'd file a bug to either help others if I figure it out myself, or if someone sees an obvious problem. It's worth noting I'm not too familiar with NPM, so I did not have an existing lock file, thus bootstrapping just to support ts_proto_library.
So essentially I have:
```
load("@rules_proto//proto:defs.bzl", "proto_lang_toolchain", "proto_library")
load("@aspect_rules_ts//ts:proto.bzl", "ts_proto_library")
load("@npm//:defs.bzl", "npm_link_all_packages")
npm_link_all_packages(name = "node_modules")
proto_library(
name = "foo_proto",
srcs = [":foo.proto"],
)
ts_proto_library(
name = "foo_ts_proto",
node_modules = ":node_modules",
proto = ":foo_proto",
)
```
And I get error:
```
no such target '//:.aspect_rules_js/node_modules/@bufbuild+protobuf@1.3.0': target '.aspect_rules_js/node_modules/@bufbuild+protobuf@1.3.0' not declared in package '' defined by /myrepo/BUILD (Tip: use `query "//:*"` to see all the targets in that package) and referenced by '//my_directory:node_modules/@bufbuild/protobuf'
```
I have a my_directory/package.json, like in the example (with a pnpm_workspace.yaml that refers to it):
```
{
"dependencies": {
"@bufbuild/protobuf": "1.3.0"
},
"devDependencies": {
"@bufbuild/protoc-gen-es": "1.3.0",
"@bufbuild/protoc-gen-connect-es": "0.12.0"
},
"type": "module"
}
```
and have generated the lock file, referencing it with:
```
npm.npm_translate_lock(
name = "npm",
# Regenerate dependencies with `bazel run -- @pnpm//:pnpm --dir $PWD install --lockfile-only`.
pnpm_lock = "//:pnpm-lock.yaml")
```
### Version
Development (host) and target OS/architectures: Linux
Output of `bazel --version`: bazel 6.0.0
Version of the Aspect rules, or other relevant rules from your
`WORKSPACE` or `MODULE.bazel` file:
```
bazel_dep(name = "aspect_rules_ts", version = "2.0.0-rc1")
bazel_dep(name = "aspect_rules_js", version = "1.32.2")
```
### How to reproduce
_No response_
### Any other information?
Using bzlmod.
Contributor guide
Research direction
Start with the BUILD configuration, my_directory/package.json, and pnpm-lock.yaml, then reproduce the failure through npm_link_all_packages, ts_proto_library, and npm.npm_translate_lock under bzlmod. Trace the missing .aspect_rules_js/node_modules target and compare the reported reference with the declared targets. Done means the failure identifies the missing virtual-store link more helpfully or no longer occurs for this setup.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- build-system, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100