Closed jesushernandez closed 1 year ago
Using chokidar
is going to be an uphill battle no matter what you do.
If you have an option to update to Node v19 your issues would go away as Turbowatch will switch to fs.watch
that is a lot more resource efficient.
Ok, we will keep an eye on the project then. We can stay with our current approach, as upgrading to v19 is not an option right now. Cheers!
Hey, this is a great tool! We've recently moved our repo to turborepo and are just configuring turbowatch to retain some of the good DX we used to have (typecheck, lint watch..)
However, we found that when turbowatch starts,
chokidar
begins indexing files and, due to how our monorepo is set up and the dependencies between packages (there might be a cycle somewhere),chokidar
never stops indexing the files insidenode_modules
. It keeps following symlinks recursively. You can see in the logs how the number of indexed files grows infinitely to the millions.chokidar
specifically allows you to provide some glob patterns of files that will be ignored (via theignored
param). Is this something the library could support? Currently we're working around this by providing a customWatcher
which is exactly the same as yourChokidarWatcher
but it creates thechokidar
instance with an additionalignored
parameter:An alternative to this would be to adapt the glob expression provided to
turbowatch
to theignored
glob chokidar accepts, which would be more efficient than scanning all files to then 'discard' most of them.We can stick to this but it'd be great if we were able to just pass some of
WatchOptions
(fromchokidar
) instead of a whole newWatcherConstructable
.What do you think? I'm happy to contribute.