Skip to content

Commit

Permalink
Don't send HMR before packaging in watch mode (#9026)
Browse files Browse the repository at this point in the history
  • Loading branch information
mischnic committed May 22, 2023
1 parent ae31614 commit ca244bb
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/reporters/dev-server/src/ServerReporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,13 @@ export default (new Reporter({
}
break;
case 'buildProgress':
if (event.phase === 'bundled' && hmrServer) {
if (
event.phase === 'bundled' &&
hmrServer &&
// Only send HMR updates before packaging if the built in dev server is used to ensure that
// no stale bundles are served. Otherwise emit it for 'buildSuccess'.
options.serveOptions !== false
) {
await hmrServer.emitUpdate(event);
}
break;
Expand All @@ -106,6 +112,9 @@ export default (new Reporter({

server.buildSuccess(event.bundleGraph, event.requestBundle);
}
if (hmrServer && options.serveOptions === false) {
await hmrServer.emitUpdate(event);
}
break;
case 'buildFailure':
// On buildFailure watchStart sometimes has not been called yet
Expand Down

0 comments on commit ca244bb

Please sign in to comment.