-
Notifications
You must be signed in to change notification settings - Fork 522
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support fine grained dependencies on node_modules #18
Comments
Just to clarify, you have a tree
Or is your vendored directory actually sources that need to be built?
do you have evidence that a smaller As a workaround, the rules here accept a |
@alexeagle we actually have
where we basically commit results of The concern I originally had with the monolithic I don't have any measurements, as there are no build rules for coffeescript, which is what a substantial portion of the repo is written in. However your question made me take a closer look at our commit history. It looks like Curious to hear your thoughts! |
for Note that you can have multiple There's a scheme in https://github.com/dropbox/rules_node to generate the bazel workspace from the package.json, which you might want to check out. |
For an idea of "how big are we talking", take https://angular.io/guide/quickstart . Following the instructions, I get a node_modules directory of 335 MB. Given that's just the recommended "getting started" Angular app, I think it's not unlikely for a combined node_modules/ for a monolithic repo to be better part of a gigabyte. That causes several problems with rules_nodejs:
(1) can only be fixed by making Bazel-native installs, in the style of https://github.com/johnynek/bazel-deps (Maven) or https://github.com/dropbox/rules_node (npm). (2), (3), (4), and (5) can be fixed in less drastic ways. npm/yarn can still resolve and install the dependencies, compile native bindings, etc. But Bazel, via the generated lock file, could understand how those installed dependencies are linked. Rules could depend on specific dependencies and rules_nodejs would understand which files those are. This is not a very complicated or error-prone algorithm, and it would help enormously with those issues. (Or you could opt-out of the fine grained dependency management, and basic workflow is still all the same.) Thoughts @alexeagle ? |
@kamalmarhubi @pauldraper Alex and I have a PR up for fine grained npm dependencies via This PR defined targets for each node module installed and will allow for the following:
|
@pauldraper We've seen performance issues with large node_module filegroups as well bazelbuild/bazel#5153 |
@gregmagolan 👍 that's exactly what I was thinking. Looks like proposal is at https://docs.google.com/document/d/1AfjHMLVyE_vYwlHSK7k7yW_IIGppSxsQtPm9PTr1xEo/preview |
This is in now, note that a breaking change is still coming in #337 |
It seems unneeded in the Angular repo now, and causes us to miss the pathmapping for '*'. Fixes bazel-contrib#18 PiperOrigin-RevId: 162747459
It seems unneeded in the Angular repo now, and causes us to miss the pathmapping for '*'. Fixes bazel-contrib#18 PiperOrigin-RevId: 162747459
We have a monorepo with a vendored
node_modules
tree. If we evaluate bazel for this codebase, our ideal use would be to allow depending on individual modules in library targets. This would let our build take advantage of bazel's sandboxing and knowledge of dependencies to vastly reduce the work done, while maintaining reproducibility.These rules appear to discourage fine-grained dependencies on modules, which will result in lots of wasted builds whenever a dependency is added, updated, or removed. Any suggestions on how to handle our use case / info on planned changes that might make it easier?
The text was updated successfully, but these errors were encountered: