Open simonzack opened 9 years ago
@simonzack The use case for this (according to https://github.com/substack/watchify/issues/56) is for when you use watchify via the command-line. How about if in bin/cmd.js
you handle the tearing down the previous watchify->browserify
instance and spinning up a new one on add
/unlink
whatever?
@zertosh Well, my implementation keeps the cache. My own use case was for gulp, but you're right that this perhaps is only half the fix, as it doesn't yet address the cmd issue.
Add/remove is done by calling the constructor, which retains the caches so builds remain fast.
I took this approach, since from my reading of the code,
reset()
needs to be called somewhere first in the chokidar handler so the pipeline can be modified, sincebundle()
was called previously.If there's a better way please let me know and I'll update the PR.