Skip to content

Commit

Permalink
fix: reload on restart with middleware mode (fixes #9038) (#9040)
Browse files Browse the repository at this point in the history
  • Loading branch information
sapphi-red committed Jul 12, 2022
1 parent e685de3 commit e372693
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/vite/src/client/client.ts
Expand Up @@ -294,7 +294,8 @@ async function waitForSuccessfulPing(hostAndPath: string, ms = 1000) {
try {
// A fetch on a websocket URL will return a successful promise with status 400,
// but will reject a networking error.
await fetch(`${location.protocol}//${hostAndPath}`)
// When running on middleware mode, it returns status 426, and an cors error happens if mode is not no-cors
await fetch(`${location.protocol}//${hostAndPath}`, { mode: 'no-cors' })
break
} catch (e) {
// wait ms before attempting to ping again
Expand Down

0 comments on commit e372693

Please sign in to comment.