browserify / watchify

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

Any way to not spawn a chokidar process at all? #242

Closed jescalan closed 9 years ago

jescalan commented 9 years ago

So when you pass ignoreWatch: true, it defaults to ignoring everything, not watching any files. However, the watcher process is still spawned if I'm not mistaken, it's just not watching anything. In this case, would it be possible to skip spawning chokidar at all, saving a process?

If the answer is yes, I'd be happy to send in a PR for this change, and if I'm totally off base, which is quite possible, would appreciate any enlightenment!

zertosh commented 9 years ago

ignoreWatch: true ignores the pattern **/node_modules/**, since that was the most common use case for ignoring. If you using that everything is getting ignored, then maybe your entire project is within a node_modules dir.

jescalan commented 9 years ago

Ah, gotchya. So is there any way to implement watchify such that it uses the cacheing system, but no watcher, assuming that I will handle the watching part and trigger a browserify build when needed? I know this is a crazy question but I promise there is a use case behind it :grinning:

zertosh commented 9 years ago

Watching does more than just trigger a rebuild, it also invalidates the cache when something changes. You can implement your own caching system in just a few lines (that cache object is consumed by module-deps).

jescalan commented 9 years ago

Right. This makes sense, I guess implementing a simple cacheing system manually is the best option here. Thanks @zertosh :grinning:

lukehorvat commented 9 years ago

FYI I've extracted watchify's caching into a separate plugin, rememberify.

If you don't need watchify's file system monitoring (because you're already using something like gulp-watch), then this plugin is a good choice.