-
Notifications
You must be signed in to change notification settings - Fork 14.5k
The Incremental API aka "The Greedy File Watcher" #31048
Copy link
Copy link
Closed
Labels
Domain: APIRelates to the public API for TypeScriptRelates to the public API for TypeScriptIn DiscussionNot yet reached consensusNot yet reached consensusQuestionAn issue which isn't directly actionable in codeAn issue which isn't directly actionable in codeSuggestionAn idea for TypeScriptAn idea for TypeScript
Description
Activity
Metadata
Metadata
Labels
Domain: APIRelates to the public API for TypeScriptRelates to the public API for TypeScriptIn DiscussionNot yet reached consensusNot yet reached consensusQuestionAn issue which isn't directly actionable in codeAn issue which isn't directly actionable in codeSuggestionAn idea for TypeScriptAn idea for TypeScript
Heya!
Maintainer of the fork-ts-checker-webpack-plugin here. Under the covers, the plugin uses the TypeScript incremental API. Various issues have been raised when using this with the level of CPU usage on idle; i.e. it's high!
The marvellous John (@NeKJ) did some digging and discovered that this could be remedied by setting an environment variable:
TSC_WATCHFILE=UseFsEventsWithFallbackDynamicPolling.This changes the behaviour of TypeScripts approach to file watching in a highly desirable fashion. You can see details of John (@NeKJ)'s investigation here:
TypeStrong/fork-ts-checker-webpack-plugin#256
As you'll see, this is a PR for
fork-ts-checker-webpack-pluginthat changes theTSC_WATCHFILEenvironment variable. If we merge it the users offork-ts-checker-webpack-pluginshould gain a better experience on the resources front.However, it feels like this is potentially the wrong place to make this change. So before we merge and ship this I wanted to throw it back to you. If this affects users of
fork-ts-checker-webpack-pluginthen I'd hazard a guess other people who use the API are being burned too. Changing the default infork-ts-checker-webpack-pluginwon't help them.Should the default file watching approach used by TypeScript be switched to
TSC_WATCHFILE=UseFsEventsWithFallbackDynamicPollingor similar? So all users of this API have a better experience?