File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
packages/vite/src/node/server Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -435,6 +435,13 @@ export async function createServer(
435435 handleFileAddUnlink ( normalizePath ( file ) , server , true )
436436 } )
437437
438+ if ( ! middlewareMode && httpServer ) {
439+ httpServer . once ( 'listening' , ( ) => {
440+ // update actual port since this may be different from initial value
441+ serverConfig . port = ( httpServer . address ( ) as AddressInfo ) . port
442+ } )
443+ }
444+
438445 // apply server configuration hooks from plugins
439446 const postHooks : ( ( ( ) => void ) | void ) [ ] = [ ]
440447 for ( const plugin of plugins ) {
@@ -564,11 +571,6 @@ export async function createServer(
564571 }
565572 return listen ( port , ...args )
566573 } ) as any
567-
568- httpServer . once ( 'listening' , ( ) => {
569- // update actual port since this may be different from initial value
570- serverConfig . port = ( httpServer . address ( ) as AddressInfo ) . port
571- } )
572574 } else {
573575 await container . buildStart ( { } )
574576 await runOptimize ( )
You can’t perform that action at this time.
0 commit comments