From 4e4b2052a30c0646fe23b4803841d38db816d120 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillaume=20h=C3=A9bert?= Date: Tue, 5 Jul 2022 20:46:03 -0400 Subject: [PATCH 1/4] Update index.ts Use hmr.port when specified --- src/index.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 98bbae9..5dafd78 100644 --- a/src/index.ts +++ b/src/index.ts @@ -400,8 +400,10 @@ function resolveDevServerUrl(address: AddressInfo, config: ResolvedConfig): DevS const configHost = typeof config.server.host === 'string' ? config.server.host : null const serverAddress = address.family === 'IPv6' ? `[${address.address}]` : address.address const host = configHmrHost ?? configHost ?? serverAddress + + const port = typeof config.server.hmr === 'object' ? (config.server.hmr.port ?? address.port) - return `${protocol}://${host}:${address.port}` + return `${protocol}://${host}:${port}` } /** From 97b887290e096aa4282f42a99ae827dbe24af7e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillaume=20h=C3=A9bert?= Date: Tue, 5 Jul 2022 20:55:08 -0400 Subject: [PATCH 2/4] Wrong TypeScript syntax --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 5dafd78..6343116 100644 --- a/src/index.ts +++ b/src/index.ts @@ -401,7 +401,7 @@ function resolveDevServerUrl(address: AddressInfo, config: ResolvedConfig): DevS const serverAddress = address.family === 'IPv6' ? `[${address.address}]` : address.address const host = configHmrHost ?? configHost ?? serverAddress - const port = typeof config.server.hmr === 'object' ? (config.server.hmr.port ?? address.port) + const port = typeof config.server.hmr === 'object' ? config.server.hmr.port : address.port return `${protocol}://${host}:${port}` } From 3a86678df9d4f0ea2011c1fa4ba867beebe0f4ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillaume=20h=C3=A9bert?= Date: Wed, 6 Jul 2022 07:37:10 -0400 Subject: [PATCH 3/4] Wrong TypeScript syntax --- src/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 6343116..34b9eec 100644 --- a/src/index.ts +++ b/src/index.ts @@ -401,7 +401,8 @@ function resolveDevServerUrl(address: AddressInfo, config: ResolvedConfig): DevS const serverAddress = address.family === 'IPv6' ? `[${address.address}]` : address.address const host = configHmrHost ?? configHost ?? serverAddress - const port = typeof config.server.hmr === 'object' ? config.server.hmr.port : address.port + const configHmrClientPort = typeof config.server.hmr === 'object' ? config.server.hmr.clientPort : null + const port = configHmrPort ?? address.port return `${protocol}://${host}:${port}` } From 7eda94c6f17fc99a25afb2238fd5a2688d64caf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillaume=20h=C3=A9bert?= Date: Wed, 6 Jul 2022 07:55:15 -0400 Subject: [PATCH 4/4] Typo --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 34b9eec..6ccec94 100644 --- a/src/index.ts +++ b/src/index.ts @@ -402,7 +402,7 @@ function resolveDevServerUrl(address: AddressInfo, config: ResolvedConfig): DevS const host = configHmrHost ?? configHost ?? serverAddress const configHmrClientPort = typeof config.server.hmr === 'object' ? config.server.hmr.clientPort : null - const port = configHmrPort ?? address.port + const port = configHmrClientPort ?? address.port return `${protocol}://${host}:${port}` }