rules_js icon indicating copy to clipboard operation
rules_js copied to clipboard

[Bug]: dependency on root //:node_modules breaks transitive deps

Open jbedard opened this issue 2 years ago • 3 comments

What happened?

See https://github.com/macourteau/aspect-tsproject-imports/tree/f008b8da3f4a5ad0e51a11da150f9171e58bf072

Run bazel run //demo/web/apps/my-web-app. The transitive deps of express are not available even though the full root node_modules is present in the runfiles. Removing this extra dep fixes it?

Version

bazel: 6.3.1 rules_js: 1.31.0 rules_ts: 1.4.5

jbedard avatar Aug 04 '23 18:08 jbedard

This does seem unexpected, and it would be good for us to understand why it happens.

alexeagle avatar Aug 08 '23 22:08 alexeagle

Removing this extra dep fixes it?

It does fix the issue, however if I then add a dep on e.g. express in my-web-app (example), then I run into the same issue again (node_modules is incomplete), and I haven't found a workaround for that yet.

Basically, it seems like depending on something, say A, that a dependency, say B, also depends on doesn't bring in the deps for A, if it has any. I've tested this with packages other than express which also have dependencies, and the outcome is the same.

macourteau avatar Aug 12 '23 14:08 macourteau

Seems like commenting out these two lines fixes the other issue I'm seeing: https://github.com/macourteau/aspect-tsproject-imports/blob/d1fb7ac139d7d673a6184d86d480ed4fe0a87e44/.bazelrc#L78-L79

I guess it would probably be good to figure out why it happens, but at least I'm able to build now. :)

macourteau avatar Aug 20 '23 01:08 macourteau