diff --git a/packages/browser/src/client/main.ts b/packages/browser/src/client/main.ts index c89721f3075d..ebf2ad4e67b0 100644 --- a/packages/browser/src/client/main.ts +++ b/packages/browser/src/client/main.ts @@ -71,6 +71,10 @@ ws.addEventListener('open', async () => { let hasSnapshot = false async function runTests(paths: string[], config: any, client: VitestClient) { + // need to import it before any other import, otherwise Vite optimizer will hang + const viteClientPath = '/@vite/client' + await import(viteClientPath) + // we use dynamic import here, because this file is bundled with UI, // but we need to resolve correct path at runtime const path = '/__vitest_index__'