Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use hmr port if specified #7282

Merged
merged 3 commits into from Mar 14, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/vite/src/node/server/ws.ts
Expand Up @@ -28,7 +28,7 @@ export function createWebSocketServer(
let httpsServer: Server | undefined = undefined

const hmr = isObject(config.server.hmr) && config.server.hmr
const wsServer = (hmr && hmr.server) || server
const wsServer = (hmr && hmr.server) || (!(hmr && hmr.port) && server)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we check for the case where hmr.port is the same as the main server port? We should re-use the server in that case, no?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated


if (wsServer) {
wss = new WebSocket({ noServer: true })
Expand Down