Skip to content

Commit 167753d

Browse files
authoredJan 4, 2023
fix(hmr): base default protocol on client source location (#11497)
1 parent 1ae018f commit 167753d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed
 

‎packages/vite/src/client/client.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const importMetaUrl = new URL(import.meta.url)
2323
// use server configuration, then fallback to inference
2424
const serverHost = __SERVER_HOST__
2525
const socketProtocol =
26-
__HMR_PROTOCOL__ || (location.protocol === 'https:' ? 'wss' : 'ws')
26+
__HMR_PROTOCOL__ || (importMetaUrl.protocol === 'https:' ? 'wss' : 'ws')
2727
const hmrPort = __HMR_PORT__
2828
const socketHost = `${__HMR_HOSTNAME__ || importMetaUrl.hostname}:${
2929
hmrPort || importMetaUrl.port

0 commit comments

Comments
 (0)
Please sign in to comment.