Skip to content

Commit b55c32f

Browse files
authoredJul 16, 2024··
fix: make server type less restrictive (fix #17627) (#17628)
1 parent 1d0d9ab commit b55c32f

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed
 

‎packages/vite/src/node/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ export type {
4747
ServerHook,
4848
ResolvedServerOptions,
4949
ResolvedServerUrls,
50+
HttpServer,
5051
} from './server'
5152
export type {
5253
BuildOptions,

‎packages/vite/src/node/server/hmr.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import fsp from 'node:fs/promises'
22
import path from 'node:path'
3-
import type { Server } from 'node:http'
43
import { EventEmitter } from 'node:events'
54
import colors from 'picocolors'
65
import type { CustomPayload, HMRPayload, Update } from 'types/hmrPayload'
@@ -14,6 +13,7 @@ import { isExplicitImportRequired } from '../plugins/importAnalysis'
1413
import { getEnvFilesForMode } from '../env'
1514
import { withTrailingSlash, wrapId } from '../../shared/utils'
1615
import type { ModuleNode } from './moduleGraph'
16+
import type { HttpServer } from '.'
1717
import { restartServerWithUrls } from '.'
1818

1919
export const debugHmr = createDebugger('vite:hmr')
@@ -30,7 +30,7 @@ export interface HmrOptions {
3030
path?: string
3131
timeout?: number
3232
overlay?: boolean
33-
server?: Server
33+
server?: HttpServer
3434
/** @internal */
3535
channels?: HMRChannel[]
3636
}

‎packages/vite/src/node/server/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ export interface ServerOptions extends CommonServerOptions {
139139
*
140140
* This is needed to proxy WebSocket connections to the parent server.
141141
*/
142-
server: http.Server
142+
server: HttpServer
143143
}
144144
/**
145145
* Options for files served via '/\@fs/'.

0 commit comments

Comments
 (0)
Please sign in to comment.