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

Apply HMR updates via node worker thread #10071

Merged
merged 1 commit into from
Jan 11, 2025
Merged

Apply HMR updates via node worker thread #10071

merged 1 commit into from
Jan 11, 2025

Conversation

devongovett
Copy link
Member

When running a node entry point via the Parcel dev server, we execute in a worker thread as of #10055. Previously we still relied on a web socket connection from the node process to the dev server for updates. However, there is an ordering requirement: when the server code is updated, the server needs to handle the HMR update first before the client tries to reload the page or it will receive out of date content or an error.

This updates the node process to use the worker thread's MessagePort to deliver HMR updates directly. The HMR client also replies back to the server after applying an update. Once this occurs, we then deliver the update via the web socket to the browser, which will reload. This way the order is guaranteed to be correct.

@devongovett devongovett merged commit ee909d4 into v2 Jan 11, 2025
17 checks passed
@devongovett devongovett deleted the node-hmr branch January 11, 2025 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant