TBH this library has caused me nothing but pain when it comes to file path matching. If I do this:
let watcher = chokidar.watch(['**/*.js']);
I also tried this, and this does not seem to work either:
let watcher = chokidar.watch('**/*.js');
Using the array, it will watch all sorts of files that don't end in '.js'...how can I tell chokidar to only watch files with a certain extension. I really don't want to use the ignore option to ignore the 15+ file extensions I don't want to watch, instead I'd rather just declare the one that I positively want to watch.
Please advise.
What would make it so much better for users, is if you could accept an array of regular expressions for the "includes" argument. Globs have always caused me a world of pain, whereas JS regexes seem to not. I closed this issue thinking I was imagining things, but I am not unfortunately.
I can confirm. Everything broke after 1.7.0 and I still cannot get an array of globs to work. Did you find a fix or workaround other than reverting back to the older version @ORESoftware ?
No updates? This issue seems to be a major one, and for sure it's blocking me from updating or using it in new project.
What about disableGlobbing option?
For me using absolute glob paths failed, using arrays or not (nothing is reported) but relative paths work (Windows platform, chokidar v2.0.4).
Not sure if this is for a good reason or a bug, but it should at least be mentioned in the docs.
Basically this does not work:
chokidar
.watch("C:/foo/bar/*.js", {
ignoreInitial: true
})
But this works:
chokidar
.watch("bar/*.js", {
ignoreInitial: true,
cwd: "C:/foo"
})
Would expect them to do the same thing, am I missing something?
Update to Chokidar v3, it should resolve this.
Most helpful comment
For me using absolute glob paths failed, using arrays or not (nothing is reported) but relative paths work (Windows platform, chokidar v2.0.4).
Not sure if this is for a good reason or a bug, but it should at least be mentioned in the docs.
Basically this does not work:
But this works:
Would expect them to do the same thing, am I missing something?