Skip to content

Commit

Permalink
commit reference from facebook#1588
Browse files Browse the repository at this point in the history
  • Loading branch information
ncruz committed Jul 15, 2019
1 parent 00b5fa9 commit c9a12c6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/react-dev-utils/webpackHotDevClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,11 @@ if (module.hot && typeof module.hot.dispose === 'function') {
var connection = new SockJS(
url.format({
protocol: window.location.protocol,
hostname: window.location.hostname,
port: window.location.port,
// hostname: window.location.hostname,
// port: window.location.port,
// https://github.com/facebook/create-react-app/pull/1588/commits/532b4636716b3006d848683131f96395e546fc1e
hostname: process.env.HOST || window.location.hostname,
port: process.env.PORT || window.location.port,
// Hardcoded in WebpackDevServer
pathname: '/sockjs-node',
})
Expand Down
5 changes: 5 additions & 0 deletions packages/react-scripts/config/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ function getClientEnvironment(publicUrl) {
// This should only be used as an escape hatch. Normally you would put
// images into the `src` and `import` them in code to get their paths.
PUBLIC_URL: publicUrl,
// Useful for allowing the hot dev websocket to connect to the host
// specified in the env file, instead of window.location, which could
// be wrong if the dev server is being proxied.
'HOST': process.env.HOST || '',
'PORT': process.env.PORT || ''
}
);
// Stringify all values so we can feed into Webpack DefinePlugin
Expand Down

0 comments on commit c9a12c6

Please sign in to comment.