Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use location.port when location.hostname is used to infer HMR socket URL #1664

Merged
merged 6 commits into from
Mar 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion client-src/default/index.js
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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