Skip to content

Running two vite servers with middleware mode prints websocket error #14328

@sheremet-va

Description

@sheremet-va

Describe the bug

When running two Vite servers with server.middlewareMode: true, then Vite prints WebSocket server error: Port is already in use to stderr.

Looking at the source code, I don't see a nice way to bypass that with a config. I see that we can define hmr.port, but for our use case (Vitest) hmr is disabled. Even more, we don't need this WS server at all.

Reproduction

https://stackblitz.com/edit/node-enw9th?file=index.mjs,index.html

Steps to reproduce

node index.mjs

System Info

stacbkblitz

Used Package Manager

npm

Logs

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    p2-nice-to-haveNot breaking anything but nice to have (priority)

    Type

    No type

    Projects

    Status

    P2 - 4

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions