user5047085
user5047085

Reputation:

Use fs.watch but ignore node_modules

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?

Upvotes: 1

Views: 2162

Answers (1)

Jim B.
Jim B.

Reputation: 4714

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.

Upvotes: 2

Related Questions