fix(core): conditionally include hostname parameter when using… (#9407)

This commit is contained in:
Jack Robson 2024-01-18 13:03:45 +00:00 committed by GitHub
parent f794559962
commit bed11f62bc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -54,7 +54,10 @@ async function choosePort(
defaultPort: number,
): Promise<number | null> {
try {
const port = await detect({port: defaultPort, hostname: host});
const port = await detect({
port: defaultPort,
...(host !== 'localhost' && {hostname: host}),
});
if (port === defaultPort) {
return port;
}