Closed
Description
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
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.