Packages

webpack

5.112.2 · 23 Oct 2026MIT76.9M / weekRepositorynpmAtom feed

Your version

5.113.0

19 Nov 2026Where it was published

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.chunkHashDependencies for chunks naming other chunks.
  • Add a sourceTest condition to use items; match /g regexps reliably.
  • Add optional SVG minification and preserve XML values and HTML style boundaries.
  • Allow usedExports and mangleExports with cacheUnaffected.

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.

  • Breaking

    Make the MultiCompiler done hook async; its sync call is deprecated.

    To check
  • Breaking

    Replace ? and # in chunk names, ids and asset names in filenames with _.

    To check
  • Breaking

    Build ESTree objects only with toEstreeObject and fromEstreeObject.

    To check
  • 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 localhost and 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.chunkHashDependencies for chunks naming other chunks.

  • Add a sourceTest condition to use items; match /g regexps reliably.

  • Add optional SVG minification and preserve XML values and HTML style boundaries.

  • Allow usedExports and mangleExports with cacheUnaffected.

  • Add an updateManifest HMR hook so plugins add their own hot update data.

  • Add a transport hook to webpack.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 MultiCompiler done hook async; its sync call is deprecated.

  • Add a faster JavaScript SourceProcessor and drop printer.load().

  • Add parseErrors and every ecmaVersion; remove JavascriptParser.extend.

  • Type a <style lang> or <script lang> body as its language's files.

  • Scope HTML class and id with 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.keys and .length when 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 await or yield hands 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 SourceProcessor run, with source maps and beautify.

  • Honor pure_funcs, drop_console, global_defs, top_retain, unused and inline in minify.

  • Honor terser's pure_getters compress option in minify.

  • Add ancestor, replace and remove to HTML syntax paths and textOf to CSS.

  • Accept a function returning the schema, the name and data path of the errors and a check precompiled with schema-utils precompile in this.getOptions(schema, configuration, check), as compiler.validate does, 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.allowOutside to write, copy and clean files outside output.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.attributes parser 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.comments to 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.convertTransforms to recompose SVG transforms as the shortest equivalent list within the precision.

  • Add optimization.minimizeOptions.xml.removeOffCanvasPaths to drop SVG paths wholly outside the root viewBox.

  • Add optimization.minimizeOptions.xml.mergeDisjointPaths to merge adjacent SVG paths whose bounds do not overlap.

  • Add XML applyTransforms, convertCurvesToArcs and opt-in svgo-style cleanups such as removeUnknownElements, and shrink SVG paths.

  • Read TypeScript in the JavaScript parser, so experiments.typescript parses once without Node.js's type stripping, and drop the experimental TypeScriptPlugin.

Patch Changes

  • Fix inner graph dropping initializers that reference undeclared identifiers.

  • Always pass a dependency array to define in 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 entry html options to pages.

  • Fix loading WebAssembly from runtime chunks emitted in subdirectories.

  • Fix output.html.inline output, 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 SourceProcessor run 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 sourceMappingURL comments with extractSourceMap even when devtool is 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 module in worker.

  • Replace ? and # in chunk names, ids and asset names in filenames with _.

  • Keep MultiCompiler watching usable when a child compiler is already running.

  • Keep compilation.namedChunks pointing 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 file fields and local file:/// 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 done taps 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.prototype keys such as toString.

  • Honor an empty ManifestPlugin prefix.

  • 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 @charset for 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 @layer statement or a nested bare :global.

  • Keep an escaped : in a CSS custom property name when dropping unused ones.

  • Keep defined undefined, NaN and Infinity values 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.ensure callback 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 composes chains 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 ManifestPlugin crashing when output.hashDigestLength is 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 if and conditional dead-code elimination picking the wrong branch when the folded test is NaN, e.g. if (0 / 0) { a } else { b } keeping a.

  • 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 none that parts a background or mask position, 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) as new a.b, keep a ? !1 : (b = 1) where !a && (b = 1) is longer, and end a function with if (a) return a for return a || void 0 when minifying.

  • Fold conditionals, returns and values further in the one-pass JavaScript minifier.

  • Drop unread let writes 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 let reads after their declaration.

  • Merge equal exits and shared assignments in the one-pass JavaScript minifier.

  • Fix require.main in one-module bundles and a hoisted top-level var 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 !!!x and writes arguments reads 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 var guard 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 ProfilingPlugin profiler'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 toEstreeObject and fromEstreeObject.

  • Stop cacheUnaffected rebuilds 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.alias maps to false instead 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 localhost and 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 provide methods.

  • Breaking

    Require minimizer-webpack-plugin 5.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, console chains, labels, global deletes and -0.

  • Drop unused labels and loops that only break, and fold typeof undefined.

  • Replace TypeScript error suppressions with real types.

  • Minify unread catch bindings, bare blocks, a?a:b and one-case switch.

  • Minify more conditionals, loop exits, dead code and unread values in one pass.

  • Accept fs typed by @types/node 26 in the input file system types.

  • Evaluate built-in calls on constants when minifying JavaScript.

  • Type rule effect values and let Profiler run without an inspector.

  • Type serializer contexts, lazy values and internal helpers without any.

  • Drop pure built-in calls and keep 0 tests 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.manifest objects and the resolve.unsafeCache map.

  • Minify JavaScript built-in calls and comparisons to shorter equivalent forms.

  • Report no result from runWithDependencies instead of nested empty arrays.

  • Declare the binary field on NormalModule generator 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.

  • futureDefaults skips assets outside output.path; copies map # to _.

  • Read the binary generator option for asset modules only.

  • Fold spread reads, new callees, tail calls, undefined in 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 if branches 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, @charset and values left open at the end of the input are kept, and a file imported with { type: "css" } is parsed as CSS.

  • Preserve -0, undefined and NaN when inlining exported constants.

  • Print JavaScript minified in one pass as a second pass would reprint it.

  • Update watchpack so an invalid sideEffects glob no longer fails the build.

  • Escape names and keys in generated code and output, and bound dotenv expansion.

  • Drop frame, basefont, bgsound end tags; keep </html> after a frameset.

  • Fold more string and >>> operands when minifying JavaScript.

  • Report an unknown regexp property name to parseError instead 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.asset options with asset/inline and asset/resource.

  • Resolve imported CSS @value URLs where defined and update importers on change.

  • Keep marker-like text as data and preserve URLs written into HTML attributes.

  • Drop nomodule scripts with module syntax from pages built with output.module.

  • Speed up the JavaScript minifier's scope analysis by reading through the path.

  • Quote non-finite numbers in compileBooleanMatcher so "NaN" evaluates as expected.

  • Drop new before RegExp on a binary pattern; add compress.pristineGlobals.

  • Fold a template substitution reading the global undefined into its name.

  • Analyze concatenated modules' scopes while parsing, without ESTree.

  • Fix HttpUriPlugin allowedUris handling of global regexps and URLs with credentials.

  • Fix IgnorePlugin skipping every other match of a global regexp.

  • Drop a ++ or -- of an unread name holding a primitive when minifying JavaScript.

  • Call evaluateDefinedIdentifier taps 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 lookup to the syntax print context; get now always returns a string.

  • Fix deep empty HTML, [x]& CSS, unbound calls and spaced template joins.

  • Type hook interceptor call and loop arguments 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 any fallback.

  • Scope the fragment of an HTML link to the page's own file with its CSS modules.

  • Type render manifest filename templates and amd options without any.

  • Minify a script charset and template tags in one pass, @layer runs 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 @layer runs 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 @import layer, 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 compileBooleanMatcher regular expressions.

  • Load externals, context module, import.meta.glob, import defer and 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.