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 document.currentScript for deriving socket connection url #1994

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions packages/react-dev-utils/webpackHotDevClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,17 @@ function destroyErrorOverlay() {
}

// Connect to WebpackDevServer via a socket.
let scriptUrl = document.currentScript
? url.parse(document.currentScript.src)
: window.location;

var connection = new SockJS(
url.format({
protocol: window.location.protocol,
hostname: window.location.hostname,
port: window.location.port,
protocol: scriptUrl.protocol,
hostname: scriptUrl.hostname,
port: scriptUrl.port,
// Hardcoded in WebpackDevServer
pathname: '/sockjs-node',
pathname: "/sockjs-node"
})
);

Expand Down