-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable chokidar-based watch #43790
Comments
Semi-related: vscode has just switched their watchers to |
Fyi, there is now extension API in VSCode to watch files and folders, you don't have to ship your own watcher solution. |
We still have the CLI watch mode and the server itself (which runs in places that are not VS Code), so we still have to have some implementation. |
Got it, then I can recommend https://github.com/parcel-bundler/watcher. There is one gotcha when considering: |
There's a few other things to consider in that TS is currently dependency free, and we use multiple types of watchers (polling versus not) for different scenarios, but parcel's watcher is certainly an improvement over the other choices from my own testing back when I was working on pyright, at the cost of having a compiled component. |
Given parcels snapshot support, we have built a polling watcher on top of it, even though that is not really advertised from the readme (implementation here). Being dependency free is a very good goal to achieve, though parcel itself also comes with very few dependencies. Ideally we could just push something like parcel down to node.js core and be done with it... |
Suggestion
π Search Terms
idle watch watcher cpu chokidar
β Viability Checklist
My suggestion meets these guidelines:
Would actually further goal 10, cross-platform development
β Suggestion
Please add one or more of these:
tsconfig::watchOptions.watchFile
andtsconfig::watchOptions.watchDirectory
env::TSC_WATCHFILE
andenv::TSC_WATCHDIRECTORY
π» Use Cases
While working with
create-react-app
, I noticed that my machine tended to get quite loud. Investigating that, I found the reason to be surprisingly large CPU utilization. That, in turn, I could trace back to this issue:TypeStrong/fork-ts-checker-webpack-plugin#236
The solution there was to switch TSC to
fs.watch
instead offs.watchFile
. That works for the most part. However, as @sheetalkamat points out in #31048 (comment), that implementation is known to be problematic. Which is why it is not the default and won't be in the foreseeable future.Prior discussions
#31048 talks about the background to this request. There, @nicoburns already asked about this:
In response, @jasonwilliams pointed out that webpack had switched back to
fs.watch
, which might indicate that it had been fixed by now. Unfortunately, node v16 still has the same warnings, and webpack's switch seems to have been less thoroughly investigated than we would have desired: webpack/watchpack#130#19762 and #17506 also showed performance issues. #19762 actually has the same resolution as TypeStrong/fork-ts-checker-webpack-plugin#236, and #17506 seems to have prompted some intensive work.
The text was updated successfully, but these errors were encountered: