Skip to content

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

Description

@dws

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

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions