Here's a typical workflow:
That's great, except if watchify takes longer than steps 3 and 4, it sucks because you either get the stale code or an error.
Is there an easy way to guarantee that doesn't ever happen? Like a way for watchify to signal to my server that it should wait another split second before trying to load the requested page? If such a thing doesn't exist, how do people deal with this problem in practice?
I must suck at Googling because I can't even find people talking about this problem except this which says "Add a simple (Node-based) server that will block on requests until the watch is done running: this would avoid the always-frustrating phenomenom of reloading the page only to find the watch hasn't quite run yet." -- but unfortunately that's an entry in a todo list, not something that exists in that repo.
If you are using Grunt or Gulp you can use the live reload plugin.
Or you can play a beep when the task is complete, so that you know when to reload the page.
Also it may be worth looking at livereloadify.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With