Skip to content

Commit

Permalink
fix: use location.port when location.hostname is used to infer HMR so…
Browse files Browse the repository at this point in the history
…cket URL (#1664)
  • Loading branch information
rlamana authored and evilebottnawi committed Mar 7, 2019
1 parent cb10f83 commit 2f7f052
Show file tree
Hide file tree
Showing 9 changed files with 273 additions and 33 deletions.
4 changes: 3 additions & 1 deletion client-src/default/index.js
Expand Up @@ -181,6 +181,7 @@ const onSocketMsg = {

let hostname = urlParts.hostname;
let protocol = urlParts.protocol;
let port = urlParts.port;

// check ipv4 and ipv6 `all hostname`
if (hostname === '0.0.0.0' || hostname === '::') {
Expand All @@ -190,6 +191,7 @@ if (hostname === '0.0.0.0' || hostname === '::') {
// eslint-disable-next-line no-bitwise
if (self.location.hostname && !!~self.location.protocol.indexOf('http')) {
hostname = self.location.hostname;
port = self.location.port;
}
}

Expand All @@ -208,7 +210,7 @@ const socketUrl = url.format({
protocol,
auth: urlParts.auth,
hostname,
port: urlParts.port,
port,
// If sockPath is provided it'll be passed in via the __resourceQuery as a
// query param so it has to be parsed out of the querystring in order for the
// client to open the socket to the correct location.
Expand Down
171 changes: 140 additions & 31 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Expand Up @@ -82,6 +82,7 @@
"marked": "^0.6.1",
"nyc": "^13.3.0",
"prettier": "^1.16.3",
"puppeteer": "^1.12.2",
"rimraf": "^2.6.2",
"standard-version": "^5.0.0",
"style-loader": "^0.23.1",
Expand Down

0 comments on commit 2f7f052

Please sign in to comment.