0
votes

I am looking at the docs for fs.watch

https://nodejs.org/docs/latest/api/fs.html#fs_fs_watch_filename_options_listener

How can I watch all files in the current directory, but ignore node_modules?

1
Why are you not using chokidar ? It have a ignored option and it is alot better than the native fs.watch module. FYI How efficient is Chokidar Node.jsDany Gagnon

1 Answers

2
votes

Doesn't look like it's possible. Just take a look at the path in the listener and do nothing if it starts with 'node_modules'.

It can't be that much of a performance hit, unless you're constantly updating modules while node is running, which would be a little strange.