Help users move the colon in their label #7834
Labels
bad error messaging
Issues where users get stuck because they don't understand what they did wrong
P4
This is either out of scope or we don't have bandwidth to review a PR. (No assignee)
stale
Issues or PRs that are stale (no activity for 30 days)
team-Starlark-Integration
Issues involving Bazel's integration with Starlark, excluding builtin symbols
type: feature request
In Angular, I have a lot of users being confused about how to formulate a label that addresses their file.
For example, we install stuff from npm, and the user wants to reference
node_modules/@package/name/path/to/file.json
They used a rule to install the dependencies which creates a workspace called npm.
How does the developer know which of these labels to use?
@npm//node_modules/@package/name/path/to:file.json
(this is the intuitive one since slashes after the colon are unusual)@npm//:node_modules/@package/name/path/to/file.json
(might look right to them since their package.json was in the root of their WORKSPACE and they already typed this once)Of course the answer is to look around for the nearest ancestor
BUILD.bazel
file in the tree, but that requires they know how to look in$(bazel info output_base)/external/npm/...
to locate files.The error from bazel is
target not declared in package
orno such package
depending where the wrong colon is, and alsomaybe add exports_files
which is not helpful in an external BUILD file.The right error message would be
you probably meant to put the colon here: @npm//node_modules/@package/name:path/to/file.json
The text was updated successfully, but these errors were encountered: