webpack
5.112.2 · 23 Oct 2026MIT76.9M / weekRepositorynpmAtom feed
Summary· from the note as AI read it
Migration neededRead before upgrading: 8 changes to make.
Before you upgrade
- ESM output now needs process.getBuiltinModule(); check target Node version
- MultiCompiler done hook is async; stop using its sync callTo check
- Stop calling printer.load(); it was removed
- Replace uses of JavascriptParser.extend, which was removed
- Stop using the removed experimental TypeScriptPlugin; use experiments.typescript
- Check output filenames: ? and # in names are now replaced with _To check
- Build ESTree objects only via toEstreeObject and fromEstreeObjectTo check
- Recheck TypeScript code using memo cache callbacks; types are stricter
Deprecated
- Use registerLoader() instead of requiring cached classes by request
New
- Treat pure CommonJS exports and
require()of pure modules as side-effect free. - Add
compilation.hooks.chunkHashDependenciesfor chunks naming other chunks. - Add a
sourceTestcondition touseitems; match/gregexps reliably. - Add optional SVG minification and preserve XML values and HTML style boundaries.
- Allow
usedExportsandmangleExportswithcacheUnaffected.
In short
25 breaking4 removed1 deprecated46 new64 faster134 fixed3 internal
- Breaking
Load Node.js builtins in ESM output through
process.getBuiltinModule(), warning where a universal target can't. - BreakingTo check
Make the
MultiCompilerdonehook async; its synccallis deprecated. - BreakingTo check
Replace
?and#in chunk names, ids and asset names in filenames with_. - BreakingTo check
Build ESTree objects only with
toEstreeObjectandfromEstreeObject. - Breaking
Type memo cache callbacks by the cache keys they are given.
- Breaking
Type the serializer contexts and the minifiers' input source maps.
- Breaking
Listen on
localhostand ignore unknown keys in the lazy compilation backend. - Breaking
Type memo cache entries by key and fix published type signatures.
Release note
Minor Changes
Treat pure CommonJS exports and
require()of pure modules as side-effect free.Add
compilation.hooks.chunkHashDependenciesfor chunks naming other chunks.Add a
sourceTestcondition touseitems; match/gregexps reliably.Add optional SVG minification and preserve XML values and HTML style boundaries.
Allow
usedExportsandmangleExportswithcacheUnaffected.Add an
updateManifestHMR hook so plugins add their own hot update data.Add a
transporthook towebpack.hmr.LazyCompilationPlugin, so a development server can serve the lazy compilation backend from its own server, and pass the options it settles on to a custom backend, which can bring its own client.Restore deep import paths Module Federation loads and expose its helpers.
Load Node.js builtins in ESM output through
process.getBuiltinModule(), warning where a universal target can't.- Deprecated
Make the
MultiCompilerdonehook async; its synccallis deprecated. Add a faster JavaScript
SourceProcessorand dropprinter.load().Add
parseErrorsand everyecmaVersion; removeJavascriptParser.extend.Type a
<style lang>or<script lang>body as its language's files.Scope HTML
classandidwith a<style module>or linked CSS module.Let JavaScript parser hook taps read nodes through the path with
path: true.Let CSS visitors replace nodes and read value ranges, and minify CSS faster.
- Removed
Drop unread call arguments and fold
Object.keysand.lengthwhen minifying. Fix
delete (null ?? x), and drop unused catch bindings when minifying.Fold
switches, literals, trims,typeof, number members; inline more; drop unread classes, dead code,?..Inline more calls, fold more, and merge imports and exports, when minifying.
Fold a value into what an
awaitoryieldhands over, and a function or object assigned to a name read once into that read, when minifying.Fold more values, tests and loop declarations when minifying.
Fold a pure call's value past another pure call when minifying.
Write strings as templates when minifying where every one can be.
Minify JavaScript in one
SourceProcessorrun, with source maps and beautify.Honor
pure_funcs,drop_console,global_defs,top_retain,unusedandinlinein minify.Honor terser's
pure_getterscompress option in minify.Add
ancestor,replaceandremoveto HTML syntax paths andtextOfto CSS.Accept a function returning the schema, the name and data path of the errors and a check precompiled with
schema-utils precompileinthis.getOptions(schema, configuration, check), ascompiler.validatedoes, and let both take the check in the configuration's place.Accept camelCase JavaScript minify option names, keeping terser's as aliases.
Fold more calls, constants and single-use values when minifying JavaScript, and print the
vars Babel writes for default parameters as ES2015 default parameters where the output may use them.Minify calls, chains, literals, updates, dead/unused code; honor
keep_fargs.Add
output.allowOutsideto write, copy and clean files outsideoutput.path.Expose the scope analysis as
webpack.javascript.syntax.scopes.Scope HTML id references and read linked sheets that are CSS modules by rule.
Support named HTML CSS modules and a
cssModules.attributesparser option.Close SVG gaps with svgo, minify SVG spellings and whitespace by default.
Add SVG options to inline stylesheets and remove chosen elements or attributes.
Join adjacent same-direction SVG path lines in structure cleanup.
Hoist values all SVG group children share and write out exact integer exponents.
Add
optimization.minimizeOptions.xml.commentsto choose which SVG and XML comments survive minification.Shorten SVG transforms that rotate about a point into one
rotate(angle x y).Add
optimization.minimizeOptions.xml.convertTransformsto recompose SVG transforms as the shortest equivalent list within the precision.Add
optimization.minimizeOptions.xml.removeOffCanvasPathsto drop SVG paths wholly outside the rootviewBox.Add
optimization.minimizeOptions.xml.mergeDisjointPathsto merge adjacent SVG paths whose bounds do not overlap.Add XML
applyTransforms,convertCurvesToArcsand opt-in svgo-style cleanups such asremoveUnknownElements, and shrink SVG paths.Read TypeScript in the JavaScript parser, so
experiments.typescriptparses once without Node.js's type stripping, and drop the experimentalTypeScriptPlugin.
Patch Changes
Fix inner graph dropping initializers that reference undeclared identifiers.
Always pass a dependency array to
definein AMD library output.Fix a crash reading a module's size after a filesystem cache restore.
Keep an outer
<a>open when a nested<a>in a table cell closes another.Decode HTML asset URLs, fix
<base href>and remote stylesheets, apply entryhtmloptions to pages.Fix loading WebAssembly from runtime chunks emitted in subdirectories.
Fix
output.html.inlineoutput, custom license banners included, and keep embedded code a minifier fails on.Throw on a write to a concatenated import in sloppy mode and after SWC minifies.
Skip work for activated lazy barrels and preserve unused nested imports.
Parse CSS and HTML faster and let a
SourceProcessorrun nest another run.Honor an explicit zero stage in
BannerPlugin.Preserve optional chains when renaming CommonJS export self-references.
Fix builds failing when a CommonJS module re-exports an ES module in a cycle.
Preserve stylesheet attributes and disabled state, and drop removed chunks' styles, during hot updates.
Preserve request order when collecting asynchronous CSS on the server.
Make external module identifiers independent of resolution order.
Deduplicate identical synthetic module graph reasons.
Preserve URL objects when resolving dynamic asset requests.
Remove
sourceMappingURLcomments withextractSourceMapeven whendevtoolis off.Load each runtime's own copy of a module whose used exports differ by runtime.
Fix formatSize for fractional byte sizes below 1.
Fix HMR when an update needs a chunk the client has not loaded, including ES module output.
Fix
new URL(…, import.meta.url)assets, workers and base URI edge cases.Create workers from an imported call listed as
fn() from moduleinworker.Replace
?and#in chunk names, ids and asset names in filenames with_.Keep
MultiCompilerwatching usable when a child compiler is already running.Keep
compilation.namedChunkspointing to existing chunks after chunks are merged or removed.Parse CSS, HTML, XML and JavaScript faster with less memory.
Reset the chunk graph when sealing a compilation again.
Fix source map hashes for
filefields and localfile:///sources.Preserve falsy default exports from SystemJS externals.
Fix WebAssembly filenames using the full hash in universal builds or next to a digest.
Avoid unused external warnings for aliases sharing the same module.
Pick up files added in a subdirectory of a recursive context in watch mode.
Wait for async
donetaps before a watch rebuild invalidated during them.Keep HMR from aborting when a change only moves modules between the chunks an
import()loads.Keep one namespace object for an ES module both imported and required.
Track called imported members and avoid repeated namespace usage analysis.
Fix HMR for loading or newer-build chunks and siblings, and manifest errors.
Load the stylesheet of a new chunk joining a loaded group on HMR update.
Fix HMR cache, CSS order, rejected accepts, over-fetching and custom chunk ids.
Avoid stack overflows and repeated scans when forming concatenation groups.
Keep named chunk ids off
Object.prototypekeys such astoString.Honor an empty
ManifestPluginprefix.Hold function keys of memory caches weakly so their entries can be collected.
Count a lone CR and a CSS form feed as line breaks in CSS and HTML locations.
Declare
@charsetfor every stylesheet asset, never for embedded CSS.Keep strings, urls and escapes intact when minifying and rewriting CSS.
Shorten a CSS number only to digits every engine lays out at the same pixel.
Keep the space before an SVG
data:URL the CSS minifier rewrites.Fill
[local]with the written name, pair grid lines, and inline@values.Scope CSS module rules after an
@layerstatement or a nested bare:global.Keep an escaped
:in a CSS custom property name when dropping unused ones.Keep defined
undefined,NaNandInfinityvalues safe from local bindings.Fix CSS, HTML and JavaScript parser divergences their own tests found.
Restore prefetch hints from dependent entries that share a runtime.
Keep the runtime a
require.ensurecallback needs when its block has no chunk.Fix CSS, HTML and JavaScript tokenizer divergences from their specs.
Keep minified XML well-formed: close a cut-off CDATA, escape a bare
&.Follow CSS module
composeschains of any depth.Keep a minified HTML page's meaning around templates, noscript and encodings.
Keep every emitted file when assets are renamed or inlined.
Keep CSS, HTML and XML beautify output the same when printed again.
Minify HTML and CSS on the first pass to what a second pass would print: shorter attribute newlines,
&and escape terminators, sorted rebuilt tags, joined<style>runs and settled<html>and<body>tags.Fix
ManifestPlugincrashing whenoutput.hashDigestLengthis greater than 32.Minify CSS on the first pass to what a second pass would print: drop a declaration an empty or repeated nested rule stood beside, a lowered
-moz-copy a twin covers, and the sides a box color fallback implies.Fix
ifand conditional dead-code elimination picking the wrong branch when the folded test isNaN, e.g.if (0 / 0) { a } else { b }keepinga.Minify CSS on the first pass to what a second pass would print: take back a prefix copy a later twin writes again, close a custom property a lone backslash ended, join or drop nested rules a repeat or an empty prelude left apart, and settle the group rules a join or a gathered layer leaves side by side.
Stop the parser printing errors for BigInt operations that throw at runtime.
Keep a CSS
nonethat parts abackgroundormaskposition, which revived it.Keep an
oklch()relative color reading a near-neutral origin's hue unminified.Track ESM build dependencies faster and drop
es-module-lexer.Minify the styles of a stylesheet's SVG
data:URL and quote it alike per pass.Keep a parenthesized string opening an arrow body from printing as a directive.
Fix CSS, HTML and JavaScript minifier output bugs found by coverage and sweeps.
Update the CSS minifier's browser support data to @mdn/browser-compat-data 8.1.9.
Write
new (0, a.b)asnew a.b, keepa ? !1 : (b = 1)where!a && (b = 1)is longer, and end a function withif (a) return aforreturn a || void 0when minifying.Fold conditionals, returns and values further in the one-pass JavaScript minifier.
Drop unread
letwrites from closures created after the declaration.Minify statements as sequences; fold known
switch, spread, unary, unset vars.Drop more unread
#__PURE__and#__NO_SIDE_EFFECTS__calls when minifying.Inline simple calls and calls of functions returning constants when minifying.
Speed up HMR rebuilds and shrink the HMR runtime.
Keep generated JavaScript valid around replacements, branches and templates.
Inline one-use calls in literals and fold
letreads after their declaration.Merge equal exits and shared assignments in the one-pass JavaScript minifier.
Fix
require.mainin one-module bundles and a hoisted top-levelvar exports.Emit shorter runtime code for chunk loading, CSS, interop and module federation.
Keep every tag of a conditional comment's body when minifying it.
Fix
!!!xand writesargumentsreads in the one-pass JavaScript minifier.Give back as written an event handler the JavaScript minifier prints as nothing.
Inline single-use functions, literals and string joins, and print once, in the one-pass minifier.
Fold the
varguard TypeScript writes for an enum when minifying.Drop unused
RegExps and split long string arrays in the one-pass minifier.Compress JavaScript smaller and correctly in one pass, with or without mangling.
Move an assignment into its call past names its new functions redeclare.
Print a number constant where a member reads it when minifying, as terser does.
Fold values into spreads and logical sides; print number members correctly.
Pass the default minifiers as functions so cold builds stay fast.
Speed up externals matching, including the built-in modules of node targets.
Open the
ProfilingPluginprofiler's session on the inspector it is given.Speed up the JavaScript minifier, which now reads its tree through the path.
Keep a strict ES module importer's interop for lazily compiled modules.
Write into the JavaScript syntax tree faster and hold less memory in it.
Walk JavaScript modules on the syntax tree, holding less memory while parsing.
Speed up CSS, HTML, XML and JavaScript parsing, printing and minifying, and allocate less while parsing.
Map JavaScript offsets to lines and columns faster, holding less memory.
Build ESTree objects only with
toEstreeObjectandfromEstreeObject.Stop
cacheUnaffectedrebuilds from reusing or keeping stale chunk graphs.Speed up the JavaScript parser walk and scope analysis, and hold less memory.
Fix the types of
replaceDuplicates' comparator and the terminal color functions.Type memo cache callbacks by the cache keys they are given.
Type the serializer contexts and the minifiers' input source maps.
Skip a loader that
resolveLoader.aliasmaps tofalseinstead of crashing.Invalidate module memo caches on dependency misses or runtime activity changes.
Stop an
id="importScripts"element from changing the automatic public path.Start the bundle even when a page element has the chunk loading global as
id.Stop the HTML minifier and generator from turning escaped text into markup.
Listen on
localhostand ignore unknown keys in the lazy compilation backend.Load a script external even when a page element has its global name.
Fix generated code around semicolons, await, replacements and file names.
Keep ESM namespace keys sorted when mixing const and getter exports.
Detect the public path, script externals and Trusted Types more reliably.
Omit names ambiguous in a nested or cyclic
export *from namespace objects.Let plugins type their build info, stats fields, code generation data and tags.
Type memo cache entries by key and fix published type signatures.
Call back with the cached value on a hit in both cache facade
providemethods.- Breaking
Require
minimizer-webpack-plugin5.14 for exact source map columns. Keep comments in returns, empty classes, CSS signs; fix mangling,
typeof(), CSS*&.Print shorter minified JavaScript in more of the cases terser shortens.
Fix minified output around
eval,with, early calls and moved functions.- Removed
Drop unread trailing arguments and write compound assignments when minifying.
Type more cache serializers by position instead of with
any.Minify more
switches,consolechains, labels, globaldeletes and-0.Drop unused labels and loops that only
break, and foldtypeof undefined.Replace TypeScript error suppressions with real types.
Minify unread catch bindings, bare blocks,
a?a:band one-caseswitch.Minify more conditionals, loop exits, dead code and unread values in one pass.
Accept
fstyped by@types/node26 in the input file system types.Evaluate built-in calls on constants when minifying JavaScript.
Type rule effect values and let
Profilerrun without an inspector.Type serializer contexts, lazy values and internal helpers without
any.Drop pure built-in calls and keep
0tests boolean when minifying JavaScript.Type the CSS hot update manifest, profiler traces and stats hooks without
any.Fix four CSS minifier outputs that changed what a stylesheet says.
Fold arrays, BigInt literals and empty strings added to strings when minifying.
Write a prefixed CSS rule's nested rules and scheme toggles under each copy.
Fold conversions, and assume built-ins of the ecma the minifier writes.
Drop more unread and dead code, and print shorter conditions when minifying.
Keep remote URLs in HTML as written instead of replacing them with
data:,.Type
output.html.manifestobjects and theresolve.unsafeCachemap.Minify JavaScript built-in calls and comparisons to shorter equivalent forms.
Report no result from
runWithDependenciesinstead of nested empty arrays.Declare the
binaryfield onNormalModulegenerator options.Handle bad package.json values and deep JSON, and keep builds fast on odd input.
Minify JavaScript dead branches, conditions, NaN, string indexes, holes and braces shorter.
Keep names in generated comments and URLs from being read as code or loaders.
futureDefaultsskips assets outsideoutput.path; copies map#to_.Read the
binarygenerator option for asset modules only.Fold spread reads,
newcallees, tail calls,undefinedin arithmetic and string reads past the end, and inline more unread calls, when minifying JavaScript.Follow namespace re-export chains to the end, so builds match on every run.
Merge the calls and tests of
ifbranches when minifying JavaScript.Keep scripts decoded as UTF-8, and run inline loaders in HTML URLs again.
The XML minifier now minifies a
<style>sheet that a dropped comment splits on the first pass, and reports each node an internal-subset entity expands to at its own reference.Keep minified and built HTML and CSS reading as their source: attributes, script and style bodies, escapes,
url()strings,@charsetand values left open at the end of the input are kept, and a file importedwith { type: "css" }is parsed as CSS.Preserve
-0,undefinedandNaNwhen inlining exported constants.Print JavaScript minified in one pass as a second pass would reprint it.
Update
watchpackso an invalidsideEffectsglob no longer fails the build.Escape names and keys in generated code and output, and bound dotenv expansion.
Drop
frame,basefont,bgsoundend tags; keep</html>after a frameset.Fold more string and
>>>operands when minifying JavaScript.Report an unknown regexp property name to
parseErrorinstead of throwing.- Deprecated
Deprecate requiring cached classes by request; use
registerLoader()instead. Escape
%in chunk URLs so a chunk file whose name holds%loads.Delete only pack files in cache cleanup and store packs restored in part.
Keep output.clean inside output.path, off dot-files and out of the project.
Speed up reads through the CSS and HTML syntax path.
Allow
module.generator.assetoptions withasset/inlineandasset/resource.Resolve imported CSS
@valueURLs where defined and update importers on change.Keep marker-like text as data and preserve URLs written into HTML attributes.
Drop
nomodulescripts with module syntax from pages built withoutput.module.Speed up the JavaScript minifier's scope analysis by reading through the path.
Quote non-finite numbers in
compileBooleanMatcherso "NaN" evaluates as expected.Drop
newbeforeRegExpon a binary pattern; addcompress.pristineGlobals.Fold a template substitution reading the global
undefinedinto its name.Analyze concatenated modules' scopes while parsing, without ESTree.
Fix
HttpUriPluginallowedUrishandling of global regexps and URLs with credentials.Fix
IgnorePluginskipping every other match of a global regexp.Drop a
++or--of an unread name holding a primitive when minifying JavaScript.Call
evaluateDefinedIdentifiertaps with the defined identifier's name.Read the initializer of a sloppy
for (var a = b in c)in scope analysis.Mark the syntax APIs and the parser's path taps as experimental.
Add
lookupto the syntax print context;getnow always returns a string.Fix deep empty HTML,
[x]&CSS, unbound calls and spaced template joins.Type hook interceptor
callandlooparguments by updating tapable to 2.3.4.Minify long CSS values faster and print a reduced call used as a template tag correctly.
Minify repeated CSS faster and print a folded template tag in one pass.
Write SVG path data relative where every engine reads the same points.
Type code generation data by its declared keys, without an
anyfallback.Scope the fragment of an HTML link to the page's own file with its CSS modules.
Type render manifest filename templates and
amdoptions withoutany.Minify a script
charsetand template tags in one pass,@layerruns faster.Keep chunk loading, runtimes and worker entries correct in edge cases.
Keep an emptied SVG
<style>and moved group values stable on a second minify.Type parser and generator factory options by their module types.
Keep an HTML page's injected tags, CSP and text imports where they apply.
Keep exports and keys named like Object.prototype members as own properties.
Bound build-time folding and globs, and fix crashes in errors, stats and wasm.
Minify nested
@layerruns in linear time and print more JS and HTML in one pass.Warn instead of failing on magic comment values that evaluate to a symbol.
Keep module evaluation order and side effects when concatenating modules.
Remove unused experimental exports from the CSS, HTML and JavaScript syntax APIs.
Type SyntaxTree node writers by the node type they write.
Preserve CSS import layers and media syntax, and keep urls out of externals.
Type a syntax processor's visitor state as undefined unless it states one.
Keep legal comments (
<!--!,@license,@preserve) when minifying XML.Start a relative chunk url with ./ when its name reads like a url scheme.
Fold more JavaScript minify cases in one pass.
Keep context requests and copy globs to what the config names.
Print shorter minified JavaScript in one pass in more cases terser shortens.
Keep typed JSON imports apart, and let HMR accept and decline take attributes.
Keep a comma expression request and
<!--operators read by a custom parse.Finish a later run of a compiler that has ProfilingPlugin instead of hanging.
Keep an HTML page in another encoding than UTF-8 in its own encoding.
Name a nested anonymous
@importlayer, and follow the output hash options.Speed up JavaScript minification by keeping the syntax walk's state on one object.
Type a DefinePlugin function value as a function or class.
Escape line terminators in
compileBooleanMatcherregular expressions.Load externals, context module,
import.meta.glob,import deferand stats code only when a build uses it, so small builds start faster.
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.