-
Notifications
You must be signed in to change notification settings - Fork 27.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Turbopack: Implement HMR in next-api (#54772)
by @jridgewell: ### What? This integrates Turbopack's HRM protocol within the existing HMR WebSocket, and implements the server-side of the Next's and Turbopack's protocols for use in next-api. ### Why? HMR makes the development experience. ### How? The (new) Turbopack HMR protocol allows reusing the existing `sendMessage` and `addMessageListener` API's already used by our HMR singleton in Pages. (App apparently doesn't have a per-chunk HMR, only per-page, so it's HMR signals are describe below.) For the next-api server-side, I implemented the following events: - `reloadPage`, for Pages when `_document` changes - `middlewareChanges` when middleware is added/deleted, or modified - `serverOnlyChanges` for Pages when a loaded page's server graph changes - `serverComponentChanges` for App when a loaded app page's server graph changes We reuse the already implemented `addedPage`, `removedPage`, and `devPagesManifestUpdate` (done via webpack, so we should eventually port that over to the Turbopack listeners). I don't know exactly where `built`, `building`, and `sync` should be integrated, so they're just not sent currently. Additionally, the client-sent events aren't implemented in the new HMR server. Depends on vercel/turborepo#5814 Closes WEB-1453 --------- Co-authored-by: Justin Ridgewell <[email protected]>
- Loading branch information
1 parent
c8e0d57
commit 56c9ad8
Showing
15 changed files
with
363 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.