Skip to content
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

TS Server keeps checking for files under node_modules/@typescript even when that directory doesn't exist #52707

Closed
mjbvz opened this issue Feb 9, 2023 · 0 comments · Fixed by #53877
Assignees
Labels
Fix Available A PR has been opened for this issue Needs Investigation This issue needs a team member to investigate its status.

Comments

@mjbvz
Copy link
Contributor

mjbvz commented Feb 9, 2023

Related to #52695

Bug Report

🔎 Search Terms

  • fs.stat
  • statSync
  • performance

Problem

Create a simple project with a single .js file and a node_modules directory. I noticed that this results in typescript checking for the existence of the standard lib files under node_modules/@typescript:

stat /Users/matb/projects/san/node_modules/@typescript/lib-es2015/promise
stat /Users/matb/projects/TypeScript/built/local/lib.es2015.promise.d.ts
stat /Users/matb/projects/TypeScript/built/local/lib.es2015.promise.d.ts
readFile 45444 0.0653829574584961ms /Users/matb/projects/TypeScript/built/local/lib.es2015.promise.d.ts

It makes two of these checks for every lib file, even though node_modules/@typescript does not exist. The results in 100 or so extra stat calls when you open a simple project consisting of a single .js file

Could we avoid hitting the file system if the parent node_modules/@typescript directory not exist? These calls are fast enough on desktop but are slower on web

@RyanCavanaugh RyanCavanaugh added the Needs Investigation This issue needs a team member to investigate its status. label Feb 17, 2023
@DanielRosenwasser DanielRosenwasser added this to the TypeScript 5.1.0 milestone Feb 25, 2023
@typescript-bot typescript-bot added the Fix Available A PR has been opened for this issue label Apr 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fix Available A PR has been opened for this issue Needs Investigation This issue needs a team member to investigate its status.
Projects
None yet
5 participants