Skip to content

Commit 20c510c

Browse files
committed
fix: import @vite/client in browser code for handling optimizer
1 parent 8294811 commit 20c510c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

packages/browser/src/client/main.ts

+4
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ ws.addEventListener('open', async () => {
7171

7272
let hasSnapshot = false
7373
async function runTests(paths: string[], config: any, client: VitestClient) {
74+
// need to import it before any other import, otherwise Vite optimizer will hang
75+
const viteClientPath = '/@vite/client'
76+
await import(viteClientPath)
77+
7478
// we use dynamic import here, because this file is bundled with UI,
7579
// but we need to resolve correct path at runtime
7680
const path = '/__vitest_index__'

0 commit comments

Comments
 (0)