Skip to content

TS Server stats files outside of project root when looking up modules #52702

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

Closed
mjbvz opened this issue Feb 9, 2023 · 5 comments
Closed

TS Server stats files outside of project root when looking up modules #52702

mjbvz opened this issue Feb 9, 2023 · 5 comments
Labels
Duplicate An existing issue was already created

Comments

@mjbvz
Copy link
Contributor

mjbvz commented Feb 9, 2023

Related to #52695

Bug Report

🔎 Search Terms

  • fs.stat
  • statSync
  • performance

Problem

While working on web project wide IntelliSense, I noticed that TS would try stating files outside of the current project root. Here's a trace of some fs.statSync on desktop. In this case the folder I have open is /Users/matb/projects/san/

/Users/matb/projects/san/node_modules/@nestjs/common
/Users/matb/projects/node_modules/@nestjs/common
/Users/matb/node_modules/@nestjs/common
/Users/node_modules/@nestjs/common
/node_modules/@nestjs/common
/Users/matb/projects/san/node_modules/@types/@nestjs/common
/Users/matb/projects/node_modules/@types/@nestjs/common
/Users/matb/node_modules/@types/@nestjs/common
/Users/node_modules/@types/@nestjs/common
/node_modules/@types/@nestjs/common
...

I know this is how node tries resolving packages, but is this something we could avoid? When opening files, we pass in a projectRootPath that I believe is intended to prevent TS from opening files outside of the workspace

These calls are relatively fast on desktop but can be very slow on web as they hit the network. I had to add some extra logic to our virtual file system to avoid making these requests

@sheetalkamat
Copy link
Member

Is this same as #52702

@fatcerberus
Copy link

Yes, this issue is the same as #52702… because that’s this issue 😉

@sandersn
Copy link
Member

sandersn commented Feb 9, 2023

Probably #52637

@sheetalkamat
Copy link
Member

Thanks @sandersn thats what i meant to paste but copied from wrong tab...

@RyanCavanaugh RyanCavanaugh added the Duplicate An existing issue was already created label Feb 14, 2023
@typescript-bot
Copy link
Collaborator

This issue has been marked as a 'Duplicate' and has seen no recent activity. It has been automatically closed for house-keeping purposes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

6 participants