Skip to content

Commit 2f7f052

Browse files
rlamanaevilebottnawi
authored andcommitted
fix: use location.port when location.hostname is used to infer HMR socket URL (#1664)
1 parent cb10f83 commit 2f7f052

File tree

9 files changed

+273
-33
lines changed

9 files changed

+273
-33
lines changed

client-src/default/index.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ const onSocketMsg = {
181181

182182
let hostname = urlParts.hostname;
183183
let protocol = urlParts.protocol;
184+
let port = urlParts.port;
184185

185186
// check ipv4 and ipv6 `all hostname`
186187
if (hostname === '0.0.0.0' || hostname === '::') {
@@ -190,6 +191,7 @@ if (hostname === '0.0.0.0' || hostname === '::') {
190191
// eslint-disable-next-line no-bitwise
191192
if (self.location.hostname && !!~self.location.protocol.indexOf('http')) {
192193
hostname = self.location.hostname;
194+
port = self.location.port;
193195
}
194196
}
195197

@@ -208,7 +210,7 @@ const socketUrl = url.format({
208210
protocol,
209211
auth: urlParts.auth,
210212
hostname,
211-
port: urlParts.port,
213+
port,
212214
// If sockPath is provided it'll be passed in via the __resourceQuery as a
213215
// query param so it has to be parsed out of the querystring in order for the
214216
// client to open the socket to the correct location.

package-lock.json

+140-31
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282
"marked": "^0.6.1",
8383
"nyc": "^13.3.0",
8484
"prettier": "^1.16.3",
85+
"puppeteer": "^1.12.2",
8586
"rimraf": "^2.6.2",
8687
"standard-version": "^5.0.0",
8788
"style-loader": "^0.23.1",

0 commit comments

Comments
 (0)