microsoft / microsoft/TypeScript

project reference resolution fails when workspace is opened through a symlinked root path

未关闭
#63,819 1 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

@andrewbranch 已经在做这个了。

开始于 2026年5月6日。

Needs Investigation
主要语言
Go
星标
111k
派生
14.3k
平均合并
2 天 4 小时
30 天内合并 PR
132

描述

## Summary

When a workspace is opened through a symlinked root path, `tsgo` language service can report `TS2307` for packages that should resolve through project references.

In our case:

- Opening the repo via `/data00/home/my-username/my-project` works
- Opening the same repo via `/home/my-username/my-project` fails
- `/home/my-username` is a symlink to `/data00/home/my-username`

The failing diagnostic is:

```ts
Cannot find module '@my-project/base' or its corresponding type declarations.ts(2307)
```

## Environment

- `tsgo` language service
- Linux
- Workspace root opened through a symlink
- Example symlink:

```bash
/home/my-username -> /data00/home/my-username
```

## Actual behavior

When opening a file through the symlinked workspace path, module resolution fails for a package that should resolve via project references.

Example:

- Works: `/data00/home/my-username/my-project/...`
- Fails: `/home/my-username/my-project/...`

## Expected behavior

The same workspace should resolve project-reference-backed packages identically whether it is opened through:

- the real path
- a symlinked root path

## Minimal reproduction

A minimal regression test was added that reproduces the issue with:

- a workspace root exposed through a symlink
- an app project
- a referenced package project
- a `node_modules` symlink from the app to the package
- a package `types` entry pointing at a generated `.d.ts` output that does not exist on disk

Behavior before the fix:

- opening through realpath resolves successfully
- opening through workspace-root symlink fails with `TS2307`

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。