You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
No way to tell .bazelignore to ignore all folders of the given name #8106
only ignores the node_modules folder at the root level where the .bazelignore file is. This means that in nodejs projects, every single node_modules folder needs to be explicitly listed in .bazelignore.
Not ignoring a node_modules folder can lead to unexpected build errors as these folders contain downloaded npm dependencies that may contain BUILD files that should be ignored. node_modules folders are almost always all untracked and ignored in .gitignore so there are often left around in subdirectories when changing git branches and these are not easily noticed as they are ignored by git.
Feature requests: what underlying problem are you trying to solve with this feature?
Have .bazelignore patterns that don't start with / match in any directory. This would match the behavior of .gitignore. For example:
# ignore root /node_modules folder
/node_modules
# ignore all folders named node_modules in the root directory or in subdirectories
node_modules
What operating system are you running Bazel on?
OSX
What's the output of bazel info release?
release 0.24.0
Any other information, logs, or outputs that you want to share?
Reacted by Tyler Smalley, Kyle Cordes, Dylan Vann, Charles Essien, Maciej, Martin Liu, Eric Klein, Nick Korostelev, Mike Morearty, YuChao Liang and 25 more
@alexeagle This issue will be a problem for rules_nodejs users after bazel-contrib/rules_nodejs#704 lands since every yarn_install & npm_install rule will create a node_modules folder somewhere in the user's WORKSPACE that will be ignored by git by default but not by bazel.
Expected behavior, from working with other tools that have a ".ignore" file, would be that node_modules ignores that dir anywhere in the tree, while /node_modules ignores it only adjacent to the .ignore file.
Reacted by Maciej, Martin Liu, Eric Klein, Charles Essien, Denys Kurylenko, Jenia Varavva, Tobias Nett, ron-stripe, Nathan Shelly, Jin Huang and 4 more
This sounds like a reasonable request. I'm a bit worried that it might be too easy to accidentally exclude a directory, and wonder if the use of a wildcard syntax on anchored patterns might help make it more explicit. But then again, it's probably better to be consistent with .gitignore syntax.
Reacted by Nathan Shelly, Mike Morearty, Yuki Karibayashi, Jake McCrary, Konstantin Erman, Felipe Torres (fforres), Kyle Cordes, Gunnar Wagenknecht and Richard Levasseur
Reacted by Nathan Shelly and Felipe Torres (fforres)
Reacted by Jake McCrary, Konstantin Erman, Xavier Bonaventura, Myles Scolnick, Felipe Torres (fforres), A A Karim, Ning Xu, Gunnar Wagenknecht, toddky, Mike Cripps and 3 more
Activity
gregmagolan commentedon Apr 21, 2019
@alexeagle This issue will be a problem for rules_nodejs users after bazel-contrib/rules_nodejs#704 lands since every yarn_install & npm_install rule will create a node_modules folder somewhere in the user's WORKSPACE that will be ignored by git by default but not by bazel.
kylecordes commentedon Oct 24, 2019
Indeed, this is a problem.
Expected behavior, from working with other tools that have a ".ignore" file, would be that
node_modulesignores that dir anywhere in the tree, while/node_modulesignores it only adjacent to the .ignore file.brandjon commentedon Feb 17, 2021
This sounds like a reasonable request. I'm a bit worried that it might be too easy to accidentally exclude a directory, and wonder if the use of a wildcard syntax on anchored patterns might help make it more explicit. But then again, it's probably better to be consistent with .gitignore syntax.
nkoroste commentedon Feb 18, 2021
+1 to this
aiuto commentedon Jan 11, 2022
This is a duplicate of #7093
guw commentedon Feb 1, 2022
Another discovery: Is Bazel not ignoring the
.gitfolder by default?Bazel: Remove usage of managed_directories
brandjon commentedon Nov 4, 2022
Closing as dup of #7093.