Skip to content
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

How to ignore searching inside node_modules #79

Open
vjpr opened this issue Oct 21, 2021 · 5 comments
Open

How to ignore searching inside node_modules #79

vjpr opened this issue Oct 21, 2021 · 5 comments

Comments

@vjpr
Copy link

vjpr commented Oct 21, 2021

Using !(node_modules)/**/package.json still seems to search within node_modules...or at least its still very slow compared to every other library I'm testing.

@Krinkle
Copy link

Krinkle commented Oct 22, 2021

I addresed a similar use case in QUnit sometime ago using picomatch incombination with a recursive fs.readdir call (for gathering files), and node-watch for performant watching over an entire project (and exclude node_modules):

qunitjs/qunit@b7fb112

I switched the "gather files" part from picomatch to tiny-glob in the above change, because I found it to make the code simpler (and probably faster too). If you need to gather all files but not enter node_modules, I would restructured the call so as to invoke glob separately for the top-level directories and skip node_modules at that level, and use glob only for recursing within each of the top-level directories.

@vjpr
Copy link
Author

vjpr commented Oct 22, 2021

In a monorepo this won't work - there will be 100s of nested node_modules. tiny-glob needs to have a way to not enter dirs.

@IanVS
Copy link

IanVS commented Sep 29, 2022

Agree, without this feature, I can't adopt tiny-glob, which I was planning to do for storybook.

@chdh
Copy link

chdh commented Dec 28, 2022

It's probably easier to add an exclude option to prevent traversing of unwanted directories.

see #74
see How to exclude directory from reading? for fast-glob

@techsin
Copy link

techsin commented May 2, 2024

any update?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants