Skip to content

Commit 5dac68c

Browse files
committed
fix: reload on restart with middleware mode
1 parent e685de3 commit 5dac68c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/vite/src/client/client.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,8 @@ async function waitForSuccessfulPing(hostAndPath: string, ms = 1000) {
294294
try {
295295
// A fetch on a websocket URL will return a successful promise with status 400,
296296
// but will reject a networking error.
297-
await fetch(`${location.protocol}//${hostAndPath}`)
297+
// When running on middleware mode, it returns status 426, and an cors error happens if mode is not no-cors
298+
await fetch(`${location.protocol}//${hostAndPath}`, { mode: 'no-cors' })
298299
break
299300
} catch (e) {
300301
// wait ms before attempting to ping again

0 commit comments

Comments
 (0)