Skip to content

Configure non-polling watcher from tsconfig.json #25715

@lauripiisang

Description

@lauripiisang

Search Terms

TSC_NONPOLLING_WATCHER , nonpolling, tsconfig

Suggestion

I'd like to be able to configure tsc polling/nonpolling approach from tsconfig.json, instead of being limited to environment variables.

Acceptance Criteria

This feature should be documented, so people know to use it, as it has true performance advantage for some scenarios, e.g.: in docker, even with delegated volumes, on macOs the tsc watcher by default eats 8-10% of CPU just watching files. With TSC_NONPOLLING_WATCHER

Use Cases

Having a central typescript-based framework, with projects based on it, we would like for the users to be able to easily override polling behavior, due to having different environment or issues arising, while retaining the ability to have non polling behavior as the default.

Examples

{
  "compilerOptions": {
    "watch": {
      "useNonPollingWatcher": true,
      "watchFile": "...",
      "watchDirectory": "..."
    }
}

Checklist

My suggestion meets these guidelines:

  • This wouldn't be a breaking change in existing TypeScript / JavaScript code
  • This wouldn't change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn't a runtime feature (e.g. new expression-level syntax)

Metadata

Metadata

Assignees

Labels

SuggestionAn idea for TypeScript

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions