NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
npm, #1572 most downloaded on npm
A development middleware for webpack
Latest stable
8.6.3
Last release today
21 Nov 2026
Ships unpredictably
gaps range from 8 days to 13 months
Nearly every release is documented
notes for 60 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
14 years old
136 releases · first in 2012
Drag across the ruler to compare, or tap a release to open it.
Clean the files writeToDisk writes when output.clean is set. webpack wrote the build to memory and cleaned only that, so the copies on disk were never
writeToDisk writes when output.clean is set. webpack wrote the build to memory and cleaned only that, so the copies on disk were never cleaned: the previous session's files stayed, and every rebuild left another main.[contenthash].js behind. The middleware now gives webpack a file system that writes to memory and, for the files writeToDisk takes, to disk, and that removes and lists files on both, so output.clean cleans the disk too, honoring clean.keep and clean.dry, in plugin mode as in standalone mode, with every webpack 5 version and with Rspack. writeToDisk: true with a file system of your own, in outputFileSystem or on the compiler, now writes to disk too: it wrote nothing there before. (by @alexander-akait in #2497)Generate the precompiled options check with schema-utils precompile --minify , which makes it about a third of the size, so it loads faster. (by @alex
schema-utils precompile --minify, which makes it about a third of the size, so it loads faster. (by @alexander-akait in #2511)Your coding agent can read these notes before it upgrades. Set up the MCP server →
Close the built-in hot transport when the compiler shuts down, so in plugin mode compiler.close() no longer leaves a WebSocket endpoint and its heartb
compiler.close() no longer leaves a WebSocket endpoint and its heartbeat running. (by @alexander-akait in #2507)Answer a Range header with more than one range with 206 Partial Content and a multipart/byteranges body, instead of the whole file. Each part carries
Answer a Range header with more than one range with 206 Partial Content and a multipart/byteranges body, instead of the whole file. Each part carries its own Content-Type and Content-Range; ranges that overlap or touch are merged first, and the parts come in the order the ranges were asked for. When the output file system can stream, each range is read on its own, so asking for a few slices of a large asset reads only those; without createReadStream, or when a strong ETag has already read the file, the parts are cut from the whole file. A request for more than 200 ranges gets the whole file, as before. modifyResponseData receives that body as a Readable, so its data (and the data it returns) is typed Buffer | Readable, which still includes a ReadStream. (by @alexander-akait in #2496)
The overlay sends the client's token along when it asks openEditorEndpoint to open a file, so a server can tell the overlay's request from one another page made. Only to an endpoint on the page's own server (a rooted path), never to an absolute url, and only when the client was given a token. (by @alexander-akait in #2488)
Read the page's own url parameters without writing a property named after each one. A parameter such as __proto__ or constructor is now looked through like any other instead of becoming a property name to write; behavior is otherwise unchanged. (by @alexander-akait in #2494)
Fix initialization with rspack, whose compiler.hooks throws when reading the validate hook it doesn't implement. (by @Cherry in #2503)
Expose the existing devMiddleware property in the Koa and Hono wrapper return types, preserving custom request and response types. (by @MehdiZare in #2489)
hot.token also takes { value, required } . With required: false a token is minted (or value used) and handed to the injected client as usual, but the
hot.token also takes { value, required }. With required: false a token is minted (or value used) and handed to the injected client as usual, but the endpoint does not refuse a client without it, so a server with policy of its own can compare it in onConnect alongside, say, the origins it already allows. The instance's new hot.tokenRequired says which applies. (by @alexander-akait in #2486)…still read until the next major release, with a deprecation warning for this package's own three. (by @alexander-akait in #2458 )
The client posts build events to the page the way webpack-dev-server's does (webpackOk, webpackErrors, webpackClose and the rest), logs Disconnected! when the connection drops and clears the build's problems from the overlay until it is back. progress accepts "circular" or "linear". Reloads skip a page that is already navigating away, use the nearest ancestor with a url of its own inside an about:blank iframe, and in apply: "reload" follow a sibling compilation's build too. (by @alexander-akait in #2425)
HotModuleReplacementPlugin now goes to every compilation the middleware serves, including server bundles that hot-reload through webpack/hot/poll. hot.client.transport also accepts a module exporting a client class of your own, and the new hot.ws option is passed to the ws server (compression, verifyClient, or a port or server of its own), with hot.cors and hot.token still checked. The connection the runtime holds is exported as webpack-dev-middleware/client/socket for tooling that listens alongside it. (by @alexander-akait in #2472)
Grouped etag, lastModified, cacheControl and cacheImmutable into cache.*, and mimeTypes and mimeTypeDefault into mime.*; the old names warn and keep working until the next major release, and the grouped name wins when both are set. Media types now resolve through mime-db directly, and mime.types belongs to its own middleware instead of being written into the table mime-types shares with the whole process. instance.context.options is a copy of the options passed, cache.control included. (by @alexander-akait in #2455)
hot.client.apply ("hmr", "hmr-only", "reload" or "nothing") says what a build does to the page, so a project without HMR still reloads on a change; a single page can choose its own mode with ?webpack-dev-middleware-apply=, and publishing { action: "reload" } reloads every page. hot.client.connect (false, or { retries, timeout }) controls connecting and reconnecting, with retries honoured on both transports. The hot, liveReload, reload, autoConnect, reconnect and timeout query parameters they replace are still read until the next major release, with a deprecation warning for this package's own three. (by @alexander-akait in #2458)
Added hot.client, which sets the browser runtime's options on the middleware under the same names the entry query takes, so a configuration no longer needs a hand-written query string. url accepts a url or its parts ({ port: 8080 }) and resolves the rest in the page, pageParamPrefix renames the per-page ?webpack-dev-middleware-apply= parameter, and logging accepts { level, name } so an embedding package can label the console with its own name. (by @alexander-akait in #2436)
Added hot.cors to choose which origins may reach the hot endpoint: Server-Sent Events still allow every origin until the next major release, while the new WebSocket transport allows only local origins and refuses others with 403 before the handshake. Added hot.token, a secret the injected client carries and the endpoint requires, for the case where a browser sends no Origin; it is off by default. (by @alexander-akait in #2444)
hot now adds the client and HotModuleReplacementPlugin to the compilation itself, so enabling it is all a webpack configuration needs. hot.inject says what is added: "all" (the default), "plugin" for a page with a client of its own, "client" for a configuration that applies the plugin itself, or "none". Web workers get a client too, nothing is injected into a non-browser target, and the HMR plugin is left out when hot.client.apply is reload or nothing. (by @alexander-akait in #2430)
The instance gains attach(server), handleUpgrade(req, socket, head), onConnect(fn) (now given the request as well as the client), publish(payload) and publishTo(client, payload), so a server can own the upgrade, decide who may listen and put payloads of its own on the stream, such as ProgressPlugin ticks. The client understands { action: "error", message }, logging the reason a server refused it and posting it to the page as webpackError. (by @alexander-akait in #2431)
hot.transport chooses how events reach the browser: Server-Sent Events (the default), "ws" for a WebSocket, or a transport of your own, which only needs onConnect, publish, publishTo and close. The client speaks both built-in wires, also exported as webpack-dev-middleware/client/sse and webpack-dev-middleware/client/ws, and behaves the same on either. (by @alexander-akait in #2420)
overlay.id names the overlay element, so a package embedding it can keep the id its users already query. The new webpack-dev-middleware/client/problem export formats one of webpack's errors or warnings with formatProblem, and showProblems accepts webpack's objects as well as strings. (by @alexander-akait in #2438)
Bound the internal url and Range header caches, which grew for the life of the process and were never released, even by close(). (by @alexander-akait in #2405)
The client exports ship type declarations and are marked as the ES modules they are. The client logs through webpack's Logger without webpack/lib/logging/runtime.js, so universal and ["web", "node"] bundles no longer pull in a node builtin and a page enforcing Trusted Types needs no guard. A module that re-exports the client can hand it its options through __webpack_dev_middleware_client_query__, and ?autoConnect is read like every other boolean. (by @alexander-akait in #2428)
Deprecated hot.progress, which keeps working until the next major release: a server that applies ProgressPlugin itself ended up with two on one compiler. Remove it, apply the plugin yourself and hand its ticks to publish; the browser-side hot.client.progress is unaffected. (by @alexander-akait in #2451)
The client keeps doing what webpack-dev-server's did: (by @alexander-akait in #2472)
apply: "reload" reloads a reconnected page whose build is out of date.hostname, port, pathname, live-reload, hot=only) still connects, with no deprecation warning for that server's own spelling.z-index and closes on Esc.The overlay takes focus when it opens and gives it back when it closes, keeps an uncaught runtime error through a successful build, passes a rejected value to runtimeErrors filters as error.cause, and no longer shows an empty card or leaves the building indicator up after a multi-compiler build. File references in absolute, Windows and file:// stack frames are now clickable. The ANSI-to-HTML conversion is built in, dropping ansi-html-community and fixing its handling of combined, short and unbalanced sequences. (by @alexander-akait in #2437)
Validate options with a precompiled schema to cut ~155ms from startup. (by @alexander-akait in #2413)
Hardened the path-traversal guards in getFilenameFromUrl: the remainder left after the publicPath prefix is stripped is checked for .. on its own, before it is joined onto the output root. A .. that leaves the output root and comes back into it, such as /assets../dist/file.js, is now refused rather than served. (by @alexander-akait in #2445)
…to quiet the browser alone. hot.statsOptions is deprecated and will be removed in the next major release; its hash , timings and children keys are now…
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. (by @bjohansebas in #2370)
Take the diagnostics a hot payload carries from the stats option, so one setting governs what a build reports in the terminal and in the browser: stats: "errors-only" keeps warnings out of both, and stats: false keeps errors and warnings out of both, the client's error overlay included — reach for the client's ?logging= or ?overlay= to quiet the browser alone. hot.statsOptions is deprecated and will be removed in the next major release; its hash, timings and children keys are now ignored, because they could leave a payload without the hash the client compares, or carry a child compilation's hash instead, which stopped updates applying and forced a full page reload on every rebuild. (by @alexander-akait in #2392)
Fixed a crash when calling invalidate() in plugin mode (isPlugin = true). Since the host (webpack-cli, webpack-dev-server, etc.) owns compiler.watch(), the middleware now invalidates the host's watching instead (each child compiler's one for a MultiCompiler on webpack < 5.109). When nothing is watching it logs a warning and completes the callback, as close() does, rather than leaving invalidate(callback) waiting on a build that never runs. (by @bjohansebas in #2378)
Reject with 403 Forbidden the requests whose resolved filename falls outside outputPath (GHSA-g84c-rxfj-3j2c). With a publicPath without a trailing slash, a sibling path sharing its prefix (/assets../secret) escaped the output root once the prefix was stripped and joined. (by @bjohansebas in #2404)
Update the changelog generator to the @changesets/get-github-info 1.0 API. (by @alexander-akait in #2396)
Update dependencies. (by @alexander-akait in #2394)
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
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 ships with the package and is added as a webpack entry. (by @bjohansebas in #2322)Fixed a crash when calling close() in plugin mode ( isPlugin = true ). Since the host (webpack-cli, webpack-dev-server, etc.) owns compiler.watch() ,
close() in plugin mode (isPlugin = true). Since the host (webpack-cli, webpack-dev-server, etc.) owns compiler.watch(), the middleware has no watching of its own to close, so close() now just calls the callback instead of throwing. (by @bjohansebas in #2347)Reuse an already active MultiCompiler watching session instead of starting a duplicate one (requires webpack >= 5.109). (by @bjohansebas in #2371 )
MultiCompiler watching session instead of starting a duplicate one (requires webpack >= 5.109). (by @bjohansebas in #2371)Replace the on-finished dependency with Node.js built-in stream.finished . (by @bjohansebas in #2346 )
on-finished dependency with Node.js built-in stream.finished. (by @bjohansebas in #2346)Respect req.url when modified by middleware such as connect-history-api-fallback . (by @bjohansebas in #2304 )
req.url when modified by middleware such as connect-history-api-fallback. (by @bjohansebas in #2304)Fixed compatibility with rspack. (by @alexander-akait in #2295 )
Fixed compatibility with rspack. (by @alexander-akait in 0b40cfd )
0b40cfd)The getFilenameFromUrl function is now asynchronous, returning a Promise that resolves to the object with the found filename (or undefined if the file
The getFilenameFromUrl function is now asynchronous, returning a Promise that resolves to the object with the found filename (or undefined if the file was not found) or throws an error if the URL cannot be processed. Additionally, the object contains the extra property with stats (file system stats) and outputFileSystem (output file system where file was found) properties. (by @alexander-akait in #2284)
Minimum supported Node.js version is 20.9.0. (by @alexander-akait in #2284)
Minimum supported webpack version is 5.101.0. (by @alexander-akait in #2284)
Added support for plugin usage, useful when the middleware will be used as a webpack plugin (no stats output, no extra actions). (by @alexander-akait in #2284)
Added the forwardError option to enable error forwarding to next middleware. (by @alexander-akait in #2284)
Enable cacheImmutable by default for immutable assets. (by @alexander-akait in #2284)
Improved initial loading module time. (by @alexander-akait in #2284)
Removed outdated code and improved performance by avoiding extra loops. (by @alexander-akait in #2284)
All notable changes to this project will be documented in this file. See standard-version for commit guidelines.
reject requests that resolve outside the output directory
7.4.5 (2025-09-24) Bug Fixes unpin memfs
7.4.4 (2025-09-23) Bug Fixes pin memfs version
no crash when headers are already sent
assetsInfo may be undefined (rspack)
added the cacheImmutable option to cache immutable assets (assets with a hash in file name like image.e12ab567.jpg)
## 7.3.0 (2024-07-18) ### Features * support hono
### 7.2.1 (2024-04-02) ### Bug Fixes * avoid extra log
support Last-Modified header generation
prefer to use fs.createReadStream over fs.readFileSync to read files
minimum supported Node.js version is 18.12.0
### 6.1.3 (2024-03-29) ### Bug Fixes * security problem
security: do not allow to read files above
types: methods should be string array
added modifyResponseData option
### 6.0.2 (2023-03-19) ### Bug Fixes * make webpack optional peerDep
update schema for index and methods properties
minimum supported webpack version is 5.0.0
security: do not allow to read files above
### 5.3.3 (2022-05-18) ### Bug Fixes * types for Request and Response
### 5.3.2 (2022-05-17) ### Bug Fixes * node types (#1195) (d68ab36) * compatibility with Node.js 18
### 5.3.1 (2022-02-01) ### Bug Fixes * types
## 5.3.0 (2021-12-16) ### Features * added types (a2fa77f) * removed cjs wrapper
update schema-utils package to 4.0.0 version
internal release, no visible changes and features
## 5.2.0 (2021-09-24) ### Features * allow array for headers option
don't read full file if Range header is present
minimum supported Node.js version is 12.13.0
## 4.3.0 (2021-05-19) ### Features * add getFilenameFromUrl to API
allow the headers option to accept function
## 4.1.0 (2021-01-15) ### Features * added the stats option
stats option (376cdba)stats to stdout instead stderr, how does webpack-cli, if you need hide stats from output please use { stats: false } or { stats: 'none' } (4de0f97)stats (4de0f97)Content-type header on unknown types (#809) (5c9eee5)connect (b83a1db)### 4.0.4 (2021-01-13) ### Bug Fixes * compatibility with webpack@4
output stats to stdout instead stderr, how does webpack-cli, if you need hide stats from output please use { stats: false } or { stats: 'none' }
compatibility with the headers option
### 4.0.1 (2020-11-09) ### Bug Fixes * compatibility with connect
compatibility with new webpack@5 API
## 4.0.0-rc.3 (2020-07-14) * internal improvements
prefer mime type option over built-in
## 4.0.0-rc.1 (2020-02-20) ### Bug Fixes * missing options.json file
output.path and output.publicPath options from the configurationstats option from the configurationwatchOptions option from the configurationwriteToDisk option now correctly works in multi-compiler modeoutputFileSystem option now correctly works in multi-compiler mode[hash]/[fullhash] in output.path and output.publicPathContent-Type header doesn't have charset=utf-8 value for custom MIME types and MIME types which can be non utf-8webpack loggermemfs package10.13.0publicPath is taken from the value of the output.publicPath option from the configuration (webpack.config.js)stats option was removed, the default value of the stats option is taken from the value of the stats option from the configuration (webpack.config.js)watchOptions was removed, the default value of the watchOptions option is taken from the value of the watchOptions option from the configuration (webpack.config.js)Content-Type header doesn't have charset=utf-8 value for custom MIME types and MIME types which can be non utf-8fs option was renamed to the outputFileSystem optionlazy option was removed without replacementlogger, logLevel and logTime options were removed without replacement. You can setup the level value using { infrastructureLogging: { level: 'warn' } }, please read https://webpack.js.org/configuration/other-options/#infrastructurelogging. You can use the infrastructurelog (infrastructureLog in webpack@5) hook to customize logs. The log property in the middleware context was renamed to loggermimeTypes option first requires you to specify an extension and then a content-type - { mimeTypes: { phtml: 'text/html' } }force option from the mimeTypes option was removed without replacementreporter option was removed without replacementgetFilenameFromUrl method was removed from the APIlocals now under res.locals.webpack - use res.locals.webpack.stats for access stats and res.locals.webpack.outputFileSystem to access outputFileSystemrespect output.path and output.publicPath options from the configuration
output.path and output.publicPath options from the configurationstats option from the configurationwatchOptions option from the configurationwriteToDisk option now correctly works in multi-compiler modeoutputFileSystem option now correctly works in multi-compiler mode[hash]/[fullhash] in output.path and output.publicPathContent-Type header doesn't have charset=utf-8 value for custom MIME types and MIME types which can be non utf-8webpack loggermemfs package10.13.0publicPath is taken from the value of the output.publicPath option from the configuration (webpack.config.js)stats option was removed, the default value of the stats option is taken from the value of the stats option from the configuration (webpack.config.js)watchOptions was removed, the default value of the watchOptions option is taken from the value of the watchOptions option from the configuration (webpack.config.js)Content-Type header doesn't have charset=utf-8 value for custom MIME types and MIME types which can be non utf-8fs option was renamed to the outputFileSystem optionlazy option was removed without replacementlogger, logLevel and logTime options were removed without replacement. You can setup the level value using { infrastructureLogging: { level: 'warn' } }, please read https://webpack.js.org/configuration/other-options/#infrastructurelogging. You can use the infrastructurelog (infrastructureLog in webpack@5) hook to customize logs. The log property in the middleware context was renamed to loggermimeTypes option first requires you to specify an extension and then a content-type - { mimeTypes: { phtml: 'text/html' } }force option from the mimeTypes option was removed without replacementreporter option was removed without replacementgetFilenameFromUrl method was removed from the APIlocals now under res.locals.webpack - use res.locals.webpack.stats for access stats and res.locals.webpack.outputFileSystem to access outputFileSystempeer dependencies with webpack@5
One column per quarter.