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
If there are multiple instances of a Chokidar watcher watching the same file, only the first change to a file is detected.
Versions:
Chokidar version [3.5.3]
Node version [v16.16.0]
OS version: [Arch Linux x86_64 Kernel 5.18.16-arch1-1]
To Reproduce:
Edit: could not reproduce on Windows 11
On a non-memory filesystem (i.e. not /tmp), run node main.mjs and create/edit hello.txt in the same directory.
// main.mjsimportchokidarfrom'chokidar'letw1=chokidar.watch([]).on('all',(event,path)=>console.log('w1',{ event, path }))letw2=chokidar.watch([]).on('all',(event,path)=>console.log('w2',{ event, path }))// if either of the following lines are commented out, change events continue to fire as expectedw1.add('hello.txt')w2.add('hello.txt')
This outputs:
w1 { event: 'add', path: 'hello.txt' }
w2 { event: 'add', path: 'hello.txt' }
w1 { event: 'change', path: 'hello.txt' }
w2 { event: 'change', path: 'hello.txt' }
# further edits to hello.txt do not cause additional change events
Oddly, there was one time in my testing where the change events did continue to fire with the above setup after I added node main.mjs to package.json's scripts field, but I could not reproduce it again.
Expected behavior
When hello.txt is edited multiple times, change events continue to fire:
Turbowatch uses [`fs.watch`](https://nodejs.org/api/fs.html#fswatchfilename-options-listener), which is known to have platform-specific caveats. Unfortunately, Watchman cannot be used due to it not supporting symbolic links (issue [#105](facebook/watchman#105 (comment))) and Chokidar cannot be used due to it failing to detect file changes (issue [#1240](paulmillr/chokidar#1240)). This is not an issue if you are using MacOS, though it may have undersirable side-effects on other platforms. Please raise an issue if you discover a platform-specific issue.
BREAKING CHANGE: Potentially breaking changes for non-MacOS platforms.
Describe the bug
If there are multiple instances of a Chokidar watcher watching the same file, only the first change to a file is detected.
Versions:
To Reproduce:
Edit: could not reproduce on Windows 11
On a non-memory filesystem (i.e. not
/tmp
), runnode main.mjs
and create/edithello.txt
in the same directory.This outputs:
Oddly, there was one time in my testing where the change events did continue to fire with the above setup after I added
node main.mjs
topackage.json
'sscripts
field, but I could not reproduce it again.Expected behavior
When
hello.txt
is edited multiple times, change events continue to fire:Additional context
Likely the cause of rollup/rollup#4508, as Rollup ends up having multiple watchers for files added by plugins via
addWatchFile
.The text was updated successfully, but these errors were encountered: