-
-
Notifications
You must be signed in to change notification settings - Fork 381
feat: add hot option for hot module replacement #2322
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
Open
bjohansebas
wants to merge
32
commits into
main
Choose a base branch
from
hot-middleware
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
88cdfe5
feat: add hot option for hot module replacement
bjohansebas 33ca807
feat: add browser client runtime for HMR (#2323)
bjohansebas cf43f84
feat: implement hot module replacement middleware (#2321)
bjohansebas a7e01df
docs: add hot module replacement example with Express server and clie…
bjohansebas f7f051e
feat: enhance error overlay with close button and improved styling
bjohansebas 1d553a2
feat: enable reload option for HMR by default and update tests
bjohansebas eca516f
feat: add SSE helper functions and tests for event streaming
bjohansebas f013629
refactor(client): inline ansi stripping and drop the strip-ansi depen…
bjohansebas 1633853
refactor(hot): drop the module map from the SSE payload (#2349)
bjohansebas 8cbbcd9
feat(client): add disconnect() to close the SSE connection (#2351)
bjohansebas d09c6be
feat(hot): include the changed file in the building event (#2352)
bjohansebas 7ba3fa7
feat(client): bring the error overlay to parity with webpack-dev-serv…
bjohansebas e1bd090
test(client): cover process-update
bjohansebas 563908a
feat(client): collapse the updated-modules list in the console (#2361)
bjohansebas a78b26c
feat(client): paginate the overlay problems (#2359)
bjohansebas 5113af5
fix(client): avoid double slash when joining dynamicPublicPath (#2348)
bjohansebas 2b57cbe
feat(hot): add a building indicator with optional compilation progres…
bjohansebas 1f258b7
docs: add HMR notes and troubleshooting section (#2362)
bjohansebas 29d46b7
fix(hot): publish sync instead of built for unchanged bundles (#2357)
bjohansebas 1abd3b2
fix(client): reload when an accept handler errors during apply (#2360)
bjohansebas 5c05907
fix(hot): scope the catch-up sync and pair bundles by name
bjohansebas a767433
fix(hot): end SSE requests that arrive after close()
bjohansebas 672da3c
feat(client): share the building indicator and track builds by source…
bjohansebas 37a99f2
feat(client): share the overlay across bundled copies and report by s…
bjohansebas e4791ea
refactor(cspell): consolidate cspell configuration into .cspell.json …
bjohansebas 37bdfe2
fix(hot): name building events and repair the client reconnect lifecycle
bjohansebas e19aad0
fix(hot): harden the SSE handshake and defer the overlay's Escape lis…
bjohansebas b1fc354
fix(hot): align statsOptions and heartbeat validation and pair duplic…
bjohansebas f01d281
fix(hot): require a leading slash in the hot path and serialize publi…
bjohansebas 0a4b35a
fix(hono): set headers in the SSE writeHead shim instead of appending
bjohansebas a144a57
docs: fix the hot option reference and add a webpack-hot-middleware m…
bjohansebas 11f24ab
docs: make the migration guide's entry snippet valid standalone JS
bjohansebas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "webpack-dev-middleware": minor | ||
| --- | ||
|
|
||
| Added a `hot` option that enables hot module replacement, replacing the need for `webpack-hot-middleware`. Pass `hot: true` to enable with defaults, or `hot: { path, heartbeat, progress, statsOptions }` to customize. The client runtime is served by the middleware itself. |
This file contains hidden or 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 hidden or 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 hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,7 +6,8 @@ logs | |
| npm-debug.log* | ||
| .eslintcache | ||
| .cspellcache | ||
| /dist | ||
| /client | ||
| dist | ||
| /local | ||
| /reports | ||
| /test/outputs | ||
|
|
||
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,33 @@ | ||
| const MIN_BABEL_VERSION = 7; | ||
|
|
||
| module.exports = (api) => { | ||
| api.assertVersion(MIN_BABEL_VERSION); | ||
| api.cache(true); | ||
|
|
||
| return { | ||
| presets: [ | ||
| [ | ||
| "@babel/preset-env", | ||
| { | ||
| modules: false, | ||
| targets: { | ||
| node: "20.9.0", | ||
| esmodules: true, | ||
| node: "0.12", | ||
| }, | ||
| }, | ||
| ], | ||
| ], | ||
| env: { | ||
| test: { | ||
| presets: [ | ||
| [ | ||
| "@babel/preset-env", | ||
| { | ||
| targets: { | ||
| node: "18.12.0", | ||
| }, | ||
| }, | ||
| ], | ||
| ], | ||
| plugins: ["@babel/plugin-transform-runtime"], | ||
| }, | ||
| }, | ||
| }; | ||
| }; | ||
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| /* eslint-disable */ | ||
|
|
||
| declare module "ansi-html-community" { | ||
| function ansiHtmlCommunity(str: string): string; | ||
| namespace ansiHtmlCommunity { | ||
| function setColors(colors: Record<string, string | string[]>): void; | ||
| } | ||
| export = ansiHtmlCommunity; | ||
| } | ||
|
|
||
| interface ClientReporter { | ||
| cleanProblemsCache(name: string): void; | ||
| problems( | ||
| type: "errors" | "warnings", | ||
| obj: { errors: string[]; warnings: string[]; name?: string }, | ||
| ): boolean; | ||
| success(obj?: { name?: string }): void; | ||
| useCustomOverlay(customOverlay: unknown): void; | ||
| } | ||
|
|
||
| interface EventSourceWrapper { | ||
| addMessageListener(fn: (event: { data: string }) => void): void; | ||
| close(): void; | ||
| } | ||
|
|
||
| interface OverlayTrustedTypesPolicy { | ||
| createHTML(value: string): string; | ||
| } | ||
|
|
||
| interface Window { | ||
| __wdmEventSourceWrapper?: Record<string, EventSourceWrapper>; | ||
| __webpack_dev_middleware_hot_reporter__?: ClientReporter; | ||
| trustedTypes?: { | ||
| createPolicy( | ||
| name: string, | ||
| rules: { createHTML(value: string): string }, | ||
| ): OverlayTrustedTypesPolicy; | ||
| }; | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.