Open sin-ack opened 6 days ago
I tried to solve this locally, but I'm kind of confused about how this should interact with importers
. My understanding is that a package can be a development dependency in one workspace and a production dependency on another. How do workspaces interact with rules_js
? Do we care about maintaining separate identities for dev and non-dev packages?
Also, it seems dev packages are filtered out twice, once during the transitive closure generation and another in helpers.get_npm_imports
. The latter IMO is invalid because it's possible that a package marked as dev in our package.json
is depended on by a production package or vice-versa (and in fact I did hit this while testing, where production packages depend on filtered out dev packages). We already culled the roots based on the user's request during the closure generation, we shouldn't cull individual packages from the graph.
What happened?
I added the following to my
MODULE.bazel
:The intention here is to use this together with
ts_project
because right now it's including dev dependencies in its output (which might actually be related to this issue...).However, when I add
dev = True
, no dependencies actually get included in the resulting linked packages, and I get errors related to missing type declarations.Version
Development (host) and target OS/architectures: Host+target: Gentoo Linux
Output of
bazel --version
: 7.4.0Version of the Aspect rules, or other relevant rules from your
WORKSPACE
orMODULE.bazel
file: 2.1.0Language(s) and/or frameworks involved: JavaScript
How to reproduce
pnpm init
pnpm i -D left-pad
(any package)echo 'require("left-pad"); require("fs").writeFileSync("dummy.txt", "");' > index.js
MODULE.bazel
:BUILD.bazel
:"pnpm": {"onlyBuiltDependencies": []}
topackage.json
bazel build repro
. Get the following error:You can remove
dev = True
from thetranslate_lock
call to have it working.Any other information?
The offending line seems to be:
https://github.com/aspect-build/rules_js/blob/a8297609b6ed6515648b3c2b9b48c0eb3b481852/npm/private/pnpm.bzl#L495