bazel-contrib / bazel-contrib/rules_nodejs

[Bug]: buildifier_prebuilt declared as dev_dependency, yet used unconditionally

Open
#3,921 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Starlark
Stars
762
Forks
531
Avg merge
10h 31m
Merged PRs (30d)
3

Description

### What happened?

Starting in 6.7.3, the rules_nodejs MODULE.bazel declares buildifier_prebuilt as a dev dependency.
However, the top-level BUILD file unconditionally load()s from @buildifier_prebuilt.

When I updated my repo to consume rules_nodejs 6.7.3, I discovered that I could not access the repo at all:
```
$ bazel query @rules_nodejs//:all-targets
[...]
(11:06:14) ERROR: error loading package '@@rules_nodejs+//': Unable to find package for @@[unknown repo 'buildifier_prebuilt' requested from @@rules_nodejs+]//:rules.bzl: The repository '@@[unknown repo 'buildifier_prebuilt' requested from @@rules_nodejs+]' could not be resolved: No repository visible as '@buildifier_prebuilt' from repository '@@rules_nodejs+'.
```

One way to work around this would be to simply delete the use of buildifier_prebuilt from this repo. I came up with a patch to do that.
I believe that another way would be to make buildifier_prebuilt _not_ be a dev dependency.

I have no preference, but I think it would be good to resolve the impedance mismatch.

### Version

Development (host) and target OS/architectures:
Ubuntu 24.04, amd64

Output of `bazel --version`:
8.3.1

Version of rules_nodejs, or other relevant rules from your
`WORKSPACE` or `MODULE.bazel` file:
6.7.3

Language(s) and/or frameworks involved:

### How to reproduce

```shell
Create a repo with a MODULE.bazel as follows:

bazel_dep(name = "rules_nodejs", version = "6.7.3")`

Then try `bazel query @rules_nodejs//:all-targets`
```

### Any other information?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.