webpack
5.112.2 · 23 Oct 2026MIT76.9M / weekRepositorynpmAtom feed
5.113.0 is the newest release of 5.x.
Summary· from the note as AI read it
Migration neededRead before upgrading: 3 changes to make.
Before you upgrade
- Update css.syntax/html.syntax uses to parser, printer, SourceProcessor
- Upgrade minimizer-webpack-plugin to 5.12 or laterTo check
- Re-run typecheck; any/object/Function types replaced with stricter ones
Deprecated
- Import moved exports and plugins from their new scopes
- Replace Harmony* names with their ESM* equivalents
New
- Apply
pluginsset on a multi-configuration array to theMultiCompiler. - Add
optimization.minimize.css.dropOverriddenDeclarations, dropping a declaration a later one overrides where no target is named. - Let
util.makeSerializabletake several requests, current one first. - Emit the source map
scopesfield, so a debugger resolves imported ESM bindings by name. - Add
library.entryExports: "all"to expose the exports of every entry module.
In short
3 breaking2 deprecated25 new21 faster79 fixed6 internal
- Breaking
Reduce
css.syntax/html.syntaxtoparser,printer,SourceProcessorwith one node path. - BreakingTo check
Require
minimizer-webpack-plugin5.12, so inline scripts in HTML minify again. - Breaking
Match
urlHintsrules written withand,or,notandglobconditions; profile hook map taps, such as resolver and parser hooks, inProfilingPlugin; reportimport.metaoption errors insiderequire.ensurecallbacks, not crash; and replaceany,objectandFunctionwith precise types in the type definitions. - Deprecated
Export more plugins under their scope, move eleven loose exports under theirs, deprecate the old, and expose
template.DependencyTemplate,module.NullFactoryandutil.makeSerializable. - Deprecated
Rename the
Harmony*names toESM*and deprecate the old spellings.
Release note
Minor Changes
Apply
pluginsset on a multi-configuration array to theMultiCompiler.Add
optimization.minimize.css.dropOverriddenDeclarations, dropping a declaration a later one overrides where no target is named.- Deprecated
Export more plugins under their scope, move eleven loose exports under theirs, deprecate the old, and expose
template.DependencyTemplate,module.NullFactoryandutil.makeSerializable. Let
util.makeSerializabletake several requests, current one first.Emit the source map
scopesfield, so a debugger resolves imported ESM bindings by name.Add
library.entryExports: "all"to expose the exports of every entry module.Recognize a required
constbinding assigned toexportsas a re-export.Accept glob patterns in more path, module and file filter options.
Bundle a run of inline
<script>tags into one chunk the page can inline.Add
module.parser.javascript.topLevelThisfor classic-scriptthissemantics.Add
module.parser.html.chunkNameand awebpackChunkNamecomment for tags.Add
include/excludeversion and request filters to shared modules.Keep module side-effect information in ESM output as PURE annotations.
Add
optimization.splitChunks.dedupDepthto discover chunk intersections.Add
optimization.minimizeOptions.json, on by default withfutureDefaults.Add
SSRManifestPluginand fix server-rendered CSS collection and adoption.Add an
ignorehook tooutput.copyand keep unfollowedfromsymlinks.Add
optimization.minimize.css.convertApproximateColors.Add XML parsing and SVG/XML minification with data URLs and attribute sorting.
Extract CSS/HTML license comments like JS and safely shorten CSS gradients.
Resolve an async
DefinePlugin.runtimeValueover an asyncbeforeParsehook.Add CSS
customMedia/customSelectorsminimize options; resolve chained names.- Deprecated
Rename the
Harmony*names toESM*and deprecate the old spellings. Reduce
css.syntax/html.syntaxtoparser,printer,SourceProcessorwith one node path.Add a JavaScript
SyntaxTreeread like the CSS one, andtoEstreeObject.Fix minified code that threw, and add
pure_conversionsandpure_heritage.Shorten more CSS values and selectors, fold longhands, order declarations and gather layer blocks.
Add
optimization.minimize.css.charset;falsedrops@charsetfor UTF-8 CSS.
Patch Changes
Join rules a gathered
@layerleaves adjacent, and an at-rule with a later one
stating the same condition; read what a condition declares.Read escaped CSS names and functions as spelled, and minify them unescaped.
Minify JavaScript, CSS and HTML assets whose names carry a
#fragment.- Breaking
Require
minimizer-webpack-plugin5.12, so inline scripts in HTML minify again. Minify the attributes of an HTML tag without rewriting the template in it.
Order joined at-rule selector lists and gather a repeated large
@layerblock.Preserve case-sensitive template identifiers when minifying HTML tag attributes.
Match Acorn's strict directives, Unicode identifiers and expression validation.
Skip concatenating modules when
optimization.providedExportsis disabled.Join rules a nesting lowering or duplicate drop left for a second pass.
Write U+00A0 in a minified HTML attribute as the character, not
.Escape a foreign
<script>or<style>body, which is character data.Name the runtime module whose generation fails while hashing.
Rebuild a module in watch when its missing unused dependencies swap.
Rebuild in watch mode when a file is deleted while a build is running.
Read a foreign
<script>or<style>body as character data, not as raw text.Keep an inline
<style>body as written when rebuilding a page webpack emitted.Fix minified HTML for
stylespellings, CSS quotes,<noscript>and a BOM.Record a build dependency required through a spread on Bun.
Write a nested selector opening on a combinator against its parent the way the printer writes one.
Fix missing async stylesheets with a shared runtime.
Support deferred imports introduced by hot updates.
Fix trailing commas in
require.resolve()andrequire.resolveWeak()calls.Keep regular expressions, functions and plugins distinct in resolver caches.
Order the list a lowered nested selector lands in on what is written, not on what was.
Hoist a vendor-prefixed nested rule for a target that reads no nesting.
Name a hoisted nested rule in the dark-scheme copy it writes.
Minify data: URL payloads in HTML attributes and
new URL, and web manifests.Fold a fallback's colors over the author's arguments, and print with
recurseBlocks: falserather than throwingRead a regular expression repeating a capture group name in linear time.
Make lazy barrels defer import declarations and keep no deferral across compilations.
Invalidate unaffected caches when connection activity or async status changes.
Order concatenated re-exports deterministically when their source order ties.
Regenerate a module's exports when a require() cycle forms or breaks around it.
Recompute re-exports, code and warnings when a module goes missing or returns.
Preserve loader resolution dependencies across cached rebuilds.
Read unwatched changes afresh and wait for restarted watch compilers to finish.
Parse loader output for
.wasmas JavaScript when async wasm is auto-enabled.Remove modules an async chunk inherits from a named parent chunk grown later.
Fix JavaScript minifier crashes, altered behavior, lost comments, unparsable output and null source map sources, including parameter aliases, ESTree trees and preserved names, and stop it writing into the caller's parse options.
Preserve the source phase of dynamic WebAssembly import contexts.
Await every async entry before resolving an ESM library import.
Keep unknown
import.metaproperties per module, alike for aliases and direct use.Return WebAssembly modules directly from eager and weak source imports.
Handle missing ESM hot update manifests in Node.js without failing HMR checks.
Speed up JavaScript parsing: comment lookup, the tokenizer and the grammar.
Prefix and drop 2009 flexbox names, keeping them where a box lays out by them.
Keep
initialwhere Gecko or WebKit reads the property's keyword apart.Fold
calc()as lightningcss does, keeping it where a bare value is refused.Keep a
color-mix()whose hue rests on a gray's conversion residue.Keep a shorthand's initial keyword where it parts two keywords of another slot.
Group
lib/andlib/dependencies/sources into directories.Treat a browserslist target given at a bare major version (e.g.
safari 10) as<major>.0when a feature's first supported version is a[major, minor]pair, so it is no longer reported as unsupported.Keep the last HMR update with
output.clean; stop rechecking removed files.Read and print a CSS backslash as the spec does, and a NUL as U+FFFD.
Make minified CSS and HTML stable on a second pass, even for truncated input.
Minify a merged
<style>run as one sheet, closing each where its input ended.Minify JavaScript with webpack's printer under
futureDefaults,terserotherwise.Preserve
wrappedContextRegExpflags when rebuilding context request matchers.Minify CSS
@supports,@importand@custom-mediaconditions, and exponent numbers.Fold unitless
hsl()/hwb()channels, and only where the separators are valid.Split
@valueimports on thefromkeyword, not a substring in the path.Destructure a dotted
DefinePluginkey whose value is falsy or a runtimeValue.Make
Stats.hasErrors()read errors through theprocessErrorshook (viagetErrors()), matchinghasWarnings(), so a plugin that filters errors out of the hook is no longer contradicted byhasErrors().Allow wrapping an external concatenated module, now asked of the module itself, and re-exporting a JSON or asset
defaultas a namespace object.Match
urlHintsrules written withand,or,notandglobconditions; profile hook map taps, such as resolver and parser hooks, inProfilingPlugin; reportimport.metaoption errors insiderequire.ensurecallbacks, not crash; and replaceany,objectandFunctionwith precise types in the type definitions.Reduce CSS and HTML build time and memory allocation.
Reuse free names instead of re-parsing modules for the entry IIFE rename.
Release each module's ast once scope-analysed, and encode each export path once.
Export a module library entry's default expression as its own binding, and keep
the export helpers where the entry is not inlined.Give a wrapped concatenated body the same function header as a module factory.
Skip reading every asset when no content hash is named.
Cut graph, cached set, lazy barrel and ESM import memory and allocations.
Stop a module source from being held as both a string and a buffer.
Read the browserslist data and options schema only when a build needs them.
Release the eval devtool's cached module sources after wrapping them.
Release the rendered module sources after emitting the chunks.
Cut the peak memory and time of minifying through webpack's printer.
Shrink minified JS: unwrap IIFEs, fold calls, drop dead code, split arrays.
Cut JavaScript minifier time and memory; keep token positions in large inputs.
Keep the
calc()around asteps()countjump-nonewould reject bare.Split the CSS syntax module into a parser file and a printer file.
Split the HTML syntax module into a parser file and a printer file.
Rename classes in
lib/so each says what it does and no two share a name.Keep the remote fallback index aligned with registered container externals when an
internalexternal precedes a real one.Stop a minified inlined chunk leaving a doubled
;in its<script>.Stop
mergeDistantRulesmangling rules or reorderingall, and merge more.Minify by parsing with webpack's own parser rather than terser's.
Read JavaScript with webpack's parser alone when minifying, refusing early errors.
Parse an
assert(...)call after an import with no semicolon, and a regular expression afteryieldin a generator method.Keep the private names a direct
evalreads when mangling.Keep a class dropped for its effects where they read a private name it declares.
Parenthesize the right side of a private
in, ayield,await, privateinor optional chain tagging a template, and aletorasyncstarting a statement or loop head, where the minifier printed code that no longer parsed or read otherwise.Keep a name a parameter list or catch parameter reads from resolving to what the function body or catch block declares, which the minifier renamed or dropped as unused.
Scope and export a CSS Modules
@valuethe same way whether local or imported.Keep CSS
border: noneand gradient fallbacks for units a target cannot read.Keep minified CSS safe for older browsers; drop dead fallbacks and overrides.
Keep CSS rules apart from a neighbor whose selector no browser parses.
Keep an
:nth-*()argument with a space after its sign as written.Keep minified CSS readable by browsers the compat data does not cover.
Keep a module its chunk still needs after
compilation.rebuildModule().Keep a CSS rule nested under a selector opening on a combinator when lowering.
Use module paths for webpack's built-in minimizers so parallel minification can load them directly in workers instead of serializing their function sources.
Keep stats from an earlier build readable after a later build no longer has one of their modules.
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.