browserify / watchify

watch mode for browserify builds
Other
1.79k stars 181 forks source link

Don't add a watcher to files which should be ignored. #232

Closed codeviking closed 9 years ago

codeviking commented 9 years ago

If you call chokidar.watch(path, { ignored: '/some/string/that/matches/path' }); it'll still add a watcher to the file.

This adds a filter in watchFile which prevents the watcher from getting added if it matches the ignored glob.

This avoided watching files in node_modules for a particular project I'm working on and also corrected a segfault which would occur as a result (because of the watch handlers attached to files which were removed via an npm update call).

zertosh commented 9 years ago

Thanks @codeviking! I wrote this up already in https://github.com/substack/watchify/pull/212 but forgot about it (prob because it meant bumping the major version). A few things:

If you want to make these changes, then I can look at your PR again - otherwise, I can move https://github.com/substack/watchify/pull/212 to anymatch and merge that tmw.

codeviking commented 9 years ago

I'm actually traveling for a week but I'm happy to make the changes once I return. No rush in merging as we're just using my fork in the interim.

Thanks!

codeviking commented 9 years ago

@zertosh Checking back in. I'll make these changes this morning and submit you an updated PR.