rollup / rollup-watch

Fast incremental rebuilds with Rollup CLI
MIT License
91 stars 23 forks source link

On error, continue to monitor all the files / modules found after the… #47

Closed Crashthatch closed 7 years ago

Crashthatch commented 7 years ago

… last successful rollup. Fixes #38.

The issue is that (at least on my Ubuntu) saving a file from a text-editor causes a "rename" event which causes the fileWatcher to stop watching the file (https://github.com/rollup/rollup-watch/blob/master/src/index.js#L20) in addition to kicking off a rollup rebuild.

Normally this is fine because the rollup completes and rollup-watch starts watching all the files again (https://github.com/rollup/rollup-watch/blob/master/src/index.js#L99), but in the case of an error it never gets there, so never starts watching again, so the file with the error is no longer watched, and fixing the error doesn't trigger a rebuild.

This PR uses the cache from the last successful rebuild to re-add filewatchers to all those files.

I added a test you can run (against the unpatched code) to see the error, then apply my patch to see it is fixed.

Tests and lint are passing.

PaulBGD commented 7 years ago

One of the biggest annoyances, glad to see a fix. I'm using this locally and don't see any issues.

Rich-Harris commented 7 years ago

Thank you! This is a very welcome fix, much appreciated. Sorry for the delayed merge, will cut a new release shortly

Rich-Harris commented 7 years ago

Took a little bit longer than I hoped, but this is released as version 4. Thanks!