File tree Expand file tree Collapse file tree 4 files changed +19
-8
lines changed
Expand file tree Collapse file tree 4 files changed +19
-8
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,10 @@ export default defineConfig({
2424 : viteDevServer . config . server . host || 'localhost'
2525 const { middleware } = await createDevToolsMiddleware ( {
2626 cwd : viteDevServer . config . root ,
27- hostWebSocket : host ,
27+ websocket : {
28+ host,
29+ https : false ,
30+ } ,
2831 context,
2932 } )
3033 viteDevServer . middlewares . use ( DEVTOOLS_MOUNT_PATH_NO_TRAILING_SLASH , middleware )
Original file line number Diff line number Diff line change @@ -33,7 +33,10 @@ export async function start(options: StartOptions) {
3333 } )
3434 const { h3 } = await createDevToolsMiddleware ( {
3535 cwd : devtools . config . root ,
36- hostWebSocket : host ,
36+ websocket : {
37+ host,
38+ https : false ,
39+ } ,
3740 context : devtools . context ,
3841 } )
3942
Original file line number Diff line number Diff line change @@ -49,7 +49,9 @@ export function DevToolsServer(): Plugin {
4949
5050 const { middleware } = await createDevToolsMiddleware ( {
5151 cwd : viteDevServer . config . root ,
52- hostWebSocket : host ,
52+ websocket : {
53+ host,
54+ } ,
5355 context,
5456 } )
5557 viteDevServer . middlewares . use ( DEVTOOLS_MOUNT_PATH , middleware )
Original file line number Diff line number Diff line change @@ -16,8 +16,11 @@ const debugInvoked = createDebug('vite:devtools:rpc:invoked')
1616
1717export interface CreateWsServerOptions {
1818 cwd : string
19- portWebSocket ?: number
20- hostWebSocket : string
19+ websocket : {
20+ port ?: number
21+ host : string
22+ https ?: DevToolsNodeContext [ 'viteConfig' ] [ 'server' ] [ 'https' ] | false
23+ }
2124 base ?: string
2225 context : DevToolsNodeContext
2326}
@@ -26,9 +29,9 @@ const ANONYMOUS_SCOPE = 'vite:anonymous:'
2629
2730export async function createWsServer ( options : CreateWsServerOptions ) {
2831 const rpcHost = options . context . rpc as unknown as RpcFunctionsHost
29- const host = options . hostWebSocket ?? 'localhost'
30- const https = options . context . viteConfig . server . https
31- const port = options . portWebSocket ?? await getPort ( { port : 7812 , host, random : true } ) !
32+ const host = options . websocket . host
33+ const https = options . websocket . https === false ? undefined : ( options . websocket . https ?? options . context . viteConfig . server . https )
34+ const port = options . websocket . port ?? await getPort ( { port : 7812 , host, random : true } ) !
3235
3336 const wsClients = new Set < WebSocket > ( )
3437
You can’t perform that action at this time.
0 commit comments