aspect-build / rules_js

High-performance Bazel rules for running Node.js tools and building JavaScript projects
https://docs.aspect.build/rules/aspect_rules_js
Apache License 2.0
306 stars 106 forks source link

[Bug]: `npm_package` is very slow for targets with a lot of dependencies #1179

Open robin-pham opened 1 year ago

robin-pham commented 1 year ago

What happened?

For targets with a lot of upstream dependencies, npm_package becomes very slow, where a "Copying files to directory" step could take upwards of 30s even if the total amount of files being copied over was just in the dozens.

Workaround

Anyone encountering this in the future, the following settings for npm_package resolved this issue:

        include_transitive_declarations = False,
        include_runfiles = False,

Version

Development (host) and target OS/architectures: mac m2

Output of bazel --version:

Version of the Aspect rules, or other relevant rules from your WORKSPACE or MODULE.bazel file:

Language(s) and/or frameworks involved:

How to reproduce

Large monorepo with a target that has enough upstream dependencies such that the total depedency graph was 10k nodes+.

Any other information?

No response

alexeagle commented 1 year ago

I think the resolution is just to help people discover those two flags if they don't mean to include those files in the package?

robin-pham commented 1 year ago

Yep! Also I was told to make an issue just to keep track as this will be fixed in the next version of rules_js

njlr commented 1 month ago

I think this may no longer be relevant?

The latest docs do not mention include_transitive_declarations and include_runfiles now defaults to False.