Skip to content

Commit

Permalink
Fix HMR in Firefox when proxy option present (#7444)
Browse files Browse the repository at this point in the history
Resolves #6720
  • Loading branch information
dmile authored and mrmckeb committed Aug 7, 2019
1 parent ea2bcb7 commit eaf0b17
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/react-dev-utils/WebpackDevServerUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -361,10 +361,14 @@ function prepareProxy(proxy, appPublicFolder) {
process.exit(1);
}

// If proxy is specified, let it handle any request except for files in the public folder.
// If proxy is specified, let it handle any request except for
// files in the public folder and requests to the WebpackDevServer socket endpoint.
// https://github.com/facebook/create-react-app/issues/6720
function mayProxy(pathname) {
const maybePublicPath = path.resolve(appPublicFolder, pathname.slice(1));
return !fs.existsSync(maybePublicPath);
const isPublicFileRequest = fs.existsSync(maybePublicPath);
const isWdsEndpointRequest = pathname.startsWith('/sockjs-node'); // used by webpackHotDevClient
return !(isPublicFileRequest || isWdsEndpointRequest);
}

if (!/^http(s)?:\/\//.test(proxy)) {
Expand Down

0 comments on commit eaf0b17

Please sign in to comment.