Skip to content

Commit eaf0b17

Browse files
dmilemrmckeb
authored andcommitted
Fix HMR in Firefox when proxy option present (#7444)
Resolves #6720
1 parent ea2bcb7 commit eaf0b17

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

packages/react-dev-utils/WebpackDevServerUtils.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -361,10 +361,14 @@ function prepareProxy(proxy, appPublicFolder) {
361361
process.exit(1);
362362
}
363363

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

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

0 commit comments

Comments
 (0)