← All tasks
javascriptvitejs/vite #21856Not a task: not reproduced

`resolve.tsconfigPaths` misresolves paths from a symlinked shared tsconfig package

envgap__vitejs__vite-21856

01 / FAILURE SIGNATURE

As reported upstream

No identifying execution failure has been captured.
Not a benchmark task.
  • In a clean container the reported failure did not reproduce, or the known fix did not make the project run.

02 / ENVIRONMENT RECIPE

Base commit
6ebcf6aa84d6627df40b5339142ca3c6bf5ad1d7
Manifest
package.json
Reproduce
Awaiting issue-specific recipe
Run under trace
Awaiting a meaningful runtime command

03 / ORIGINAL ISSUE TEXT

vitejs/vite #21856 · read the original issue
### Describe the bug

Vite 8 builtin `resolve.tsconfigPaths` resolves imports incorrectly when an app `tsconfig.json` extends a shared tsconfig package through a workspace symlink.

In the repro:

- `packages/app/tsconfig.json` extends `@repro/tsconfig/base`
- `@repro/tsconfig` is a workspace package symlinked into `node_modules`
- the shared base config defines exact `paths` entries for:
  - `@repro/shared-ui`
  - `@repro/shared-ui/components`

These imports should resolve to source files via tsconfig paths:

- `@repro/shared-ui` -> `src/index.ts`
- `@repro/shared-ui/components` -> `src/components/index.ts`

Instead, with builtin `resolve.tsconfigPaths`, they resolve to package fallback targets:

- `@repro/shared-ui` -> `dist/index.js`
- `@repro/shared-ui/components` -> `components.json`

Using `vite-tsconfig-paths@6.1.1` in the same repo resolves both imports to source correctly.

The repro intentionally includes `packages/shared-ui/components.json` to make the incorrect fallback obvious. Without that file, the same broken resolution path would still not resolve to
source, and would instead fall back to `dist/components/index.js`.

A useful control case is included in the repro: if `packages/app/tsconfig.json` is changed to extend `../../tooling/tsconfig/base.json` directly instead of `@repro/tsconfig/base`, builtin
`resolve.tsconfigPaths` also resolves both imports to source correctly.

So the issue appears to be specifically related to resolving `extends` through the symlinked tsconfig package path.

### Reproduction

https://github.com/luxass/vite-tsconfig-repro

### Steps to reproduce

1. Run `pnpm install`
2. Run `cd packages/app`
3. Run `pnpm dev:builtin`
4. Observe that the app renders:

```json
{
  "expected": {
    "sharedUi": "src/index.ts",
    "sharedUiComponents": "src/components/index.ts"
  },
  "actual": {
    "sharedUi": "dist/index.js",
    "sharedUiComponents": "components.json"
  }
}
```

5. Run pnpm dev:plugin
6. Observe that the app resolves both imports to source correctly
7. Optionally, in packages/app/tsconfig.json, comment:
   "extends": "@repro/tsconfig/base"
   and uncomment:
   "extends": "../../tooling/tsconfig/base.json"
8. Run pnpm dev:builtin again
9. Observe that builtin resolve.tsconfigPaths then resolves both imports to source correctly

### System Info

```shell
System:
  OS: macOS 26.3
  CPU: (12) arm64 Apple M2 Max
  Memory: 225.20 MB / 32.00 GB
  Shell: 5.9 - /bin/zsh
Binaries:
  Node: 22.18.0 - /Users/[redacted]/.local/state/fnm_multishells/69591_1773470025327/bin/node
  npm: 10.9.3 - /Users/[redacted]/.local/state/fnm_multishells/69591_1773470025327/bin/npm
  pnpm: 10.32.1 - /Users/[redacted]/.local/state/fnm_multishells/69591_1773470025327/bin/pnpm
  bun: 1.3.10 - /opt/homebrew/bin/bun
  Deno: 2.7.5 - /opt/homebrew/bin/deno
Browsers:
  Chrome: 145.0.7632.160
  Firefox: 148.0
  Safari: 26.3
npmPackages:
  vite: 8.0.0 => 8.0.0
```

### Used Package Manager

pnpm

### Logs

_No response_

### Validations

- [x] Follow our [Code of Conduct](https://github.com/vitejs/vite/blob/main/CODE_OF_CONDUCT.md)
- [x] Read the [Contributing Guidelines](https://github.com/vitejs/vite/blob/main/CONTRIBUTING.md).
- [x] Read the [docs](https://vite.dev/guide).
- [x] Check that there isn't [already an issue](https://github.com/vitejs/vite/issues) that reports the same bug to avoid creating a duplicate.
- [x] Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to [vuejs/core](https://github.com/vuejs/core) instead.
- [x] Check that this is a concrete bug. For Q&A open a [GitHub Discussion](https://github.com/vitejs/vite/discussions) or join our [Discord Chat Server](https://chat.vite.dev/).
- [x] The provided reproduction is a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of the bug.
Continue on GitHub ↗

04 / LABELS

Labels from the report text only; not yet run

No supported category has been assigned.

Label rules and the text that matched
[]