Skip to content
Open
Show file tree
Hide file tree
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 May 16, 2026
33ca807
feat: add browser client runtime for HMR (#2323)
bjohansebas Jun 16, 2026
cf43f84
feat: implement hot module replacement middleware (#2321)
bjohansebas Jun 16, 2026
a7e01df
docs: add hot module replacement example with Express server and clie…
bjohansebas Jun 16, 2026
f7f051e
feat: enhance error overlay with close button and improved styling
bjohansebas Jun 16, 2026
1d553a2
feat: enable reload option for HMR by default and update tests
bjohansebas Jun 16, 2026
eca516f
feat: add SSE helper functions and tests for event streaming
bjohansebas Jun 16, 2026
f013629
refactor(client): inline ansi stripping and drop the strip-ansi depen…
bjohansebas Jul 20, 2026
1633853
refactor(hot): drop the module map from the SSE payload (#2349)
bjohansebas Jul 20, 2026
8cbbcd9
feat(client): add disconnect() to close the SSE connection (#2351)
bjohansebas Jul 20, 2026
d09c6be
feat(hot): include the changed file in the building event (#2352)
bjohansebas Jul 20, 2026
7ba3fa7
feat(client): bring the error overlay to parity with webpack-dev-serv…
bjohansebas Jul 20, 2026
e1bd090
test(client): cover process-update
bjohansebas Jul 21, 2026
563908a
feat(client): collapse the updated-modules list in the console (#2361)
bjohansebas Jul 23, 2026
a78b26c
feat(client): paginate the overlay problems (#2359)
bjohansebas Jul 23, 2026
5113af5
fix(client): avoid double slash when joining dynamicPublicPath (#2348)
bjohansebas Jul 23, 2026
2b57cbe
feat(hot): add a building indicator with optional compilation progres…
bjohansebas Jul 23, 2026
1f258b7
docs: add HMR notes and troubleshooting section (#2362)
bjohansebas Jul 23, 2026
29d46b7
fix(hot): publish sync instead of built for unchanged bundles (#2357)
bjohansebas Jul 23, 2026
1abd3b2
fix(client): reload when an accept handler errors during apply (#2360)
bjohansebas Jul 23, 2026
5c05907
fix(hot): scope the catch-up sync and pair bundles by name
bjohansebas Jul 23, 2026
a767433
fix(hot): end SSE requests that arrive after close()
bjohansebas Jul 23, 2026
672da3c
feat(client): share the building indicator and track builds by source…
bjohansebas Jul 24, 2026
37a99f2
feat(client): share the overlay across bundled copies and report by s…
bjohansebas Jul 24, 2026
e4791ea
refactor(cspell): consolidate cspell configuration into .cspell.json …
bjohansebas Jul 24, 2026
37bdfe2
fix(hot): name building events and repair the client reconnect lifecycle
bjohansebas Jul 24, 2026
e19aad0
fix(hot): harden the SSE handshake and defer the overlay's Escape lis…
bjohansebas Jul 24, 2026
b1fc354
fix(hot): align statsOptions and heartbeat validation and pair duplic…
bjohansebas Jul 24, 2026
f01d281
fix(hot): require a leading slash in the hot path and serialize publi…
bjohansebas Jul 24, 2026
0a4b35a
fix(hono): set headers in the SSE writeHead shim instead of appending
bjohansebas Jul 24, 2026
a144a57
docs: fix the hot option reference and add a webpack-hot-middleware m…
bjohansebas Jul 24, 2026
11f24ab
docs: make the migration guide's entry snippet valid standalone JS
bjohansebas Jul 25, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/hot-middleware-migration.md
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.
17 changes: 15 additions & 2 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,18 @@
"finalhandler",
"hono",
"rspack",
"malformed"
"apos",
"malformed",
"Consolas",
"cspellcache",
"CSSOM",
"darkgrey",
"eslintcache",
"esmodules",
"mbold",
"mred",
"noopener",
"noreferrer"
],
"ignorePaths": [
"CHANGELOG.md",
Expand All @@ -36,6 +47,8 @@
"coverage",
"*.log",
"./test/fixtures/**",
"./test/outputs/**"
"./test/outputs/**",
"client/**",
"examples/*/dist/**"
]
}
2 changes: 2 additions & 0 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ on:
branches:
- main
- next
- hot-middleware
pull_request:
branches:
- main
- next
- hot-middleware

permissions:
contents: read
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ logs
npm-debug.log*
.eslintcache
.cspellcache
/dist
/client
dist
/local
/reports
/test/outputs
Expand Down
266 changes: 266 additions & 0 deletions README.md

Large diffs are not rendered by default.

22 changes: 18 additions & 4 deletions babel.config.js
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",
},
Comment thread
bjohansebas marked this conversation as resolved.
},
],
],
env: {
test: {
presets: [
[
"@babel/preset-env",
{
targets: {
node: "18.12.0",
},
},
],
],
plugins: ["@babel/plugin-transform-runtime"],
},
},
};
};
39 changes: 39 additions & 0 deletions client-src/globals.d.ts
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;
};
}
Loading
Loading