Describe the bug
server in the user config option called middlewareMode and server in the hmr options are typed as http.Server. But because the httpServer belonging to the ViteDevServer is typed as something less restrictive, ViteDevServer's own httpServer cannot be used as server in the middlewareMode or hmr options for another vite config. This seems unnecessary, especially since doing so anyway (despite TypeScript's protests) still results in a working config.
I intend to submit a PR for this issue.
Reproduction
https://github.com/emilefokkema/vite-server-type-reproduction
Steps to reproduce
Run npm install followed by npm run typecheck
System Info
System:
OS: macOS 13.5.1
CPU: (10) arm64 Apple M1 Pro
Memory: 1.43 GB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.15.0 - ~/.nvm/versions/node/v20.15.0/bin/node
npm: 10.7.0 - ~/.nvm/versions/node/v20.15.0/bin/npm
pnpm: 9.4.0 - /usr/local/bin/pnpm
Browsers:
Chrome: 126.0.6478.127
Safari: 16.6
npmPackages:
vite: ^5.3.3 => 5.3.3
Used Package Manager
npm
Logs
No response
Validations
Describe the bug
serverin the user config option calledmiddlewareModeandserverin thehmroptions are typed ashttp.Server. But because thehttpServerbelonging to theViteDevServeris typed as something less restrictive,ViteDevServer's ownhttpServercannot be used asserverin themiddlewareModeorhmroptions for another vite config. This seems unnecessary, especially since doing so anyway (despite TypeScript's protests) still results in a working config.I intend to submit a PR for this issue.
Reproduction
https://github.com/emilefokkema/vite-server-type-reproduction
Steps to reproduce
Run
npm installfollowed bynpm run typecheckSystem Info
System: OS: macOS 13.5.1 CPU: (10) arm64 Apple M1 Pro Memory: 1.43 GB / 32.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 20.15.0 - ~/.nvm/versions/node/v20.15.0/bin/node npm: 10.7.0 - ~/.nvm/versions/node/v20.15.0/bin/npm pnpm: 9.4.0 - /usr/local/bin/pnpm Browsers: Chrome: 126.0.6478.127 Safari: 16.6 npmPackages: vite: ^5.3.3 => 5.3.3Used Package Manager
npm
Logs
No response
Validations