diff --git a/packages/angular/build/src/utils/check-port.ts b/packages/angular/build/src/utils/check-port.ts index d7c04f0b9f72..7f68c3b266fd 100644 --- a/packages/angular/build/src/utils/check-port.ts +++ b/packages/angular/build/src/utils/check-port.ts @@ -15,11 +15,11 @@ function createInUseError(port: number): Error { } export async function checkPort(port: number, host: string): Promise { - // Disabled due to Vite not handling port 0 and instead always using the default value (5173) - // TODO: Enable this again once Vite is fixed - // if (port === 0) { - // return 0; - // } + // A port of 0 requests an OS-assigned ephemeral port. Vite now binds this correctly + // (https://github.com/vitejs/vite/pull/23158); webpack-dev-server always has. + if (port === 0) { + return 0; + } return new Promise((resolve, reject) => { const server = createServer();