microsoft / microsoft/TypeScript

Module resolution should not look for node_modules outside project roots

Open
#52,637 7 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Awaiting More Feedback Suggestion
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
1d 19h
Merged PRs (30d)
117

Description

Currently, module resolution looks for node_modules all the way to the root of the filesystem. However, this is slow for certain virtual filesystems, like the one used in vscode-web, which maps only a part of the file system to in-memory files and the rest to web requests. https://github.com/microsoft/vscode/pull/173591 shows the workaround needed to stop tsserver from reading these parts of the filesystem.

Instead, module resolution should not look for node_modules directories outside project roots -- at least as specified in updateOpen messages, but I think there are other ways too.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing module resolution from updateOpen messages and the tsserver workaround described in the issue. Determine how project roots bound the search, then verify that resolution no longer reads node_modules outside those roots and add coverage for the affected behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.