Skip to content
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

chore: set resolve.mainFields and resolve.conditions for SSR environment #6896

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions packages/vitest/src/node/plugins/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,17 @@ export async function VitestPlugin(
// https://github.com/vitejs/vite/pull/16453
emptyOutDir: false,
},
// @ts-expect-error environments only exists in Vite 6
sapphi-red marked this conversation as resolved.
Show resolved Hide resolved
sapphi-red marked this conversation as resolved.
Show resolved Hide resolved
environments: {
sapphi-red marked this conversation as resolved.
Show resolved Hide resolved
ssr: {
resolve: {
// by default Vite resolves `module` field, which not always a native ESM module
// setting this option can bypass that and fallback to cjs version
mainFields: [],
conditions: ['node'],
},
},
},
test: {
poolOptions: {
threads: {
Expand Down
Loading