Skip to content

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

Closed
@mjbvz

Description

@mjbvz

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

Metadata

Metadata

Assignees

Labels

Fix AvailableA PR has been opened for this issueNeeds InvestigationThis issue needs a team member to investigate its status.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions