vitest-dev / vitest-dev/vitest

setupFiles doesn't respect custom `ssr.resolve.conditions`

Open
#9,429 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

pending triage
Dominant language
TypeScript
Stars
17.1k
Forks
2k
Avg merge
1d 22h
Merged PRs (30d)
94

Description

Describe the bug

When using setupFiles, it doesn't respect custom ssr.resolve.conditions from the vite.config.ts to add monorepo-local setup files from packages. I'd originally asked about this in https://github.com/vitest-dev/vitest/discussions/9353, but I was looking into it again and I noticed that it looks like this worked when https://github.com/vitest-dev/vitest/issues/6992 was filed/fixed, so I'm refiling as a regression.

Reproduction

https://stackblitz.com/edit/vitest-dev-vitest-6hyfbf3b?file=vite.config.ts

To demonstrate this is a resolution bug: in packages/project-b/package.json, set the default export condition to point at the .ts file instead of the .js file to fix it (which, however, isn't an option for us, however, because project-b is published to npm).

System Info
System:
    OS: macOS 26.2
    CPU: (10) arm64 Apple M4
    Memory: 204.11 MB / 24.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 24.12.0 - /Users/dukese01/.local/share/mise/installs/node/24.12.0/bin/node
    npm: 11.6.2 - /Users/dukese01/.local/share/mise/installs/node/24.12.0/bin/npm
    pnpm: 10.26.0 - /Users/dukese01/.local/share/mise/installs/node/24.12.0/bin/pnpm
    Deno: 2.6.4 - /opt/homebrew/bin/deno
    Watchman: 2026.01.05.00 - /opt/homebrew/bin/watchman
  Browsers:
    Chrome: 143.0.7499.170
    Safari: 26.2
  npmPackages:
    @vitest/eslint-plugin: 1.6.1 => 1.6.1 
    vitest: 4.0.15 => 4.0.15
Used Package Manager

pnpm

Validations

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 with the StackBlitz reproduction and inspect vite.config.ts alongside packages/project-b/package.json, especially the export conditions and the setupFiles configuration. Trace how the custom ssr.resolve.conditions are applied during setup-file resolution; done means the monorepo-local TypeScript setup file resolves under the custom conditions without requiring the package's default condition to change.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vite
Domain
testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.