diff --git a/packages/vitest/src/node/plugins/runnerTransform.ts b/packages/vitest/src/node/plugins/runnerTransform.ts index 017bac54f..e302d5388 100644 --- a/packages/vitest/src/node/plugins/runnerTransform.ts +++ b/packages/vitest/src/node/plugins/runnerTransform.ts @@ -145,6 +145,12 @@ export function ModuleRunnerTransform(): VitePlugin { // in both SSR and Client environments environment.resolve.noExternal = true + // Workaround `noExternal` merging bug on Vite 6 + // https://github.com/vitejs/vite/pull/20502 + if (name === 'ssr') { + delete config.ssr?.noExternal + } + if (name === '__vitest_vm__' || name === '__vitest__') { continue }