Cannot watch relative paths
BlackGlory opened this issue · 2 comments
BlackGlory commented
I noticed that relative paths watchers don't emit events at all.
// no events
const watcher = new Watcher(this.dirname, {
renameDetection: true
, ignoreInitial: true
, recursive: true
})
// emit events
const watcher = new Watcher(path.resolve(this.dirname), {
renameDetection: true
, ignoreInitial: true
, recursive: true
})
Is this expected behavior?
fabiospampinato commented
Is this expected behavior?
Not really, I think I wrote the library without thinking of this use case. I think it should either throw and tell you to use an absolute path or just resolve relative paths automatically for you, I'm not sure which one would be better. The second option would be more convenient but also more error prone.
MikeJerred commented
Just ran into this bug myself. I vote for throwing an error, having an option to specify the cwd is just unnecessary bloat.