You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
browser-sync's watchEvents documentation says that it is an array that can be used to specify "which file events to respond to." and these correspond to chokidar events. It appears that these are being ignored. The default of ['change'], or an explicit setting, will respond on all events (including the unlink events which is why I noticed).
Steps to reproduce/test case
I have an example of this issue available in this repository with only browser-sync as a dependency, and as minimal as a setup as I think possible.
Using this the following configuration will still result in browser-sync reloading on deletions (unlink):
From what I can see the default callback from lib/file-watcher.js is getting called with the correct event each time. It looks like the subscribe function from lib/internal-events.js is then getting called with a value that has a type === 'reload' and a files array that has the correct event: 'unlink' in it.
The problem, I think, that I can't figure out is why lib/file-utils.js.changedFile is never getting called as far as I can tell. From commit de2e2fa it looks like that should be where the filtering is done. I found that commit by finding issue #1291.
I don't know why changedFile never gets called, or why the handler gets called with a type: 'reload' every time, but I'm starting to hit a wall with figuring that out.
This will ignore the unlink event which stops browser-sync from reloading when a file is deleted as part of a clean task that happens before a build, and holds off reloading till the new file is added.
Issue details
browser-sync's watchEvents documentation says that it is an array that can be used to specify "which file events to respond to." and these correspond to chokidar events. It appears that these are being ignored. The default of
['change']
, or an explicit setting, will respond on all events (including theunlink
events which is why I noticed).Steps to reproduce/test case
I have an example of this issue available in this repository with only browser-sync as a dependency, and as minimal as a setup as I think possible.
Using this the following configuration will still result in browser-sync reloading on deletions (unlink):
Please specify which version of Browsersync, node and npm you're running
Affected platforms
Browsersync use-case
The text was updated successfully, but these errors were encountered: