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

Don't send HMR updates before packaging in watch mode #9026

Merged
merged 2 commits into from May 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 10 additions & 1 deletion packages/reporters/dev-server/src/ServerReporter.js
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