browserify / watchify

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

Serialize watchify cache? #306

Open alexbakerdev opened 8 years ago

alexbakerdev commented 8 years ago

So I tried serialising the watchify cache using JSON.stringify and parse, When starting watchify again with the saved cache it builds fine (and quickly), but the watches seem not to be in place, as no file changes trigger an update event.

I took a quick gander through the source code and it wasn't super obvious why, I'm busy at the moment but will try to fix (unless this isn't desirable for some reason) in a few days.

wnr commented 8 years ago

Hi, I too discover this problem. The problem occurs because file watches are added on the browserify file event. This event is not triggered by browserify for files present in the cache (I do not know if this is intended or not), so the files present in the cache never get watched. I'll submit a PR adding a fix that adds watches to the files present in the cache at initialisation.

wnr commented 8 years ago

I think that the issue title should be renamed to "Initially cached files not watched", since the issue has nothing to do with how the cache is serialized.