Skip to content

Watcher recursively watches irrelevant directoriesΒ #58319

Closed as not planned
Closed as not planned
@dmichon-msft

Description

@dmichon-msft

πŸ”Ž Search Terms

watch, excess, files, directories

πŸ•— Version & Regression Information

  • This changed between versions 5.0.4 and 5.1.3, still present in typescript@next

⏯ Playground Link

No response

πŸ’» Code

Repro

Steps:

npm install -g pnpm
pnpm -r install
pnpm -r build
cd b/2/b-impl/b
./node_modules/.bin/tsc --watch --extendedDiagnostics

Once the build finishes, create a file tmp.txt in a/2/logs and observe that TypeScript acts on the file change.

πŸ™ Actual behavior

If a folder is added to TypeScript's list of "failed lookup locations", any file change at any level within said folder will trigger a rebuild, even if the change is in a nested folder that was not probed during module resolution.

πŸ™‚ Expected behavior

TypeScript only watches contents of directories that contain files that were referenced in a tsconfig or probed during module resolution.

Additional information about the issue

Environment: GitHub Codespaces
OS: #19~22.04.1-Ubuntu SMP Wed Jan 10 22:57:03 UTC 2024
node 18.20.2

Metadata

Metadata

Assignees

Labels

Working as IntendedThe behavior described is the intended behavior; this is not a bug

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions