webpack
5.112.2 · 23 Oct 2026MIT76.9M / weekRepositorynpmAtom feed
5.113.0 is the newest release of 5.x.
In short
1 security40 new10 faster61 fixed
- Security
Reject
__proto__,constructorandprototypepath segments incli.processArgumentsto prevent prototype pollution.
Release note
Minor Changes
Treat top-level await and
import.metaas ES module markers, matching Node.js syntax detection so no explicit module type is needed.Add a
buntarget that emits ESM and externalizesbun:*and node.js built-in modules.Support CommonJS reexports via
Object.definePropertyvalue and getter descriptors.Support JSON Schema
constwhen generating CLI flags from a schema.Support JSON Schema
if/then/elsewhen generating CLI flags from a schema.Skip import specifiers,
require()andimport()calls in dead conditional branches gated by inlined imported constants (isDEV ? A : B), evaluated viagetCondition.CSS
localIdentName[hash]now resolves to the local ident hash (matching css-loader); use[modulehash]for the module hash.Add CSS parser
asoption and resolveurl()inside HTMLstyleattributes.Add dedicated module classes for all built-in module types.
Support
.html/.cssfor the default./srcentry under the html/css experiments.Add
defineConfighelper for typed configuration files.Add a
denotarget (with versions, e.g.deno,deno2,deno1.40) that emits ESM, resolves node.js built-ins via the requirednode:specifier, and keeps Deno's own import protocols (npm:,jsr:,node:,http(s)://) external.Use
module-importfor electron externals when the target supports ESM.Add
output.environment.logicalAssignmentto emit||=in runtime code when the target supports logical assignment operators.Resolve and rewrite asset URLs inside
<iframe srcdoc>in HTML modules.Add HMR support for HTML modules with body/title DOM patching on update.
Add
css-urlhtml source type extractingurl()references from CSS-valued attributes.Add
module.parser.html.sourcesoption to disable or customize URL-attribute extraction for HTML modules, withscript/script-module/stylesheet/stylesheet-inlinetypes for custom attributesAdd
module.parser.html.templateoption to transform HTML module source before parsing.Extract more source URLs in HTML modules (SVG, legacy and obsolete attributes).
Inline
export default <const>when the default-exported value is a primitive constant.Support
optimization.inlineExportsfor better tree-shaking.Re-encode inline hash digests (
[contenthash]/[chunkhash]/[fullhash]/[modulehash]) from the full content hash, so they carry full entropy and work underoptimization.realContentHashand in dynamically-loaded chunk filenames; also preserve leading zero bytes in base-N digests.Allow tree-shaking unused calls to
/*#__NO_SIDE_EFFECTS__*/-annotated (pure) exports across module boundaries.Defer building unused re-export targets of side-effect-free barrel modules.
Keep export mangling enabled for modules whose namespace object is used as a whole value, by materializing a decoupled namespace object that keeps the original export names.
Add
output.environment.letoption (paired with target'sletcapability) and emitlet/constinstead ofvarin generated runtime code wherever it is safe. Bindings that may be wrapped in runtime-conditionifblocks (harmony imports, ConcatenatedModule external imports) continue to usevarto preserve function scoping.Add
output.htmlto emit an HTML file per entrypoint, injecting its JS/CSS chunks (includingdependOnshared chunks).Add
module.parser.javascript.pureFunctionsto mark top-level names as side-effect-free for tree shaking.Add
universaltocompiler.platform, true for universal targets ("universal"or["web", "node"]).Add
output.strictModuleResolutionto gate the runtimeMODULE_NOT_FOUNDguard.Support an inline digest in hash path placeholders, e.g.
[contenthash:base64:8].Support
[uniqueName]and its[uniquename]alias in template paths.Support CSS in Node for universal targets, collecting styles for SSR.
Improve commonjs, node-commonjs and global externals for universal targets.
Add a
universaltarget preset (browser + web worker + Node.js + Electron + NW.js) that always outputs ECMAScript modules.Support
new Worker(new URL(...))in universal (node + web) targets by resolving the Worker constructor fromworker_threadswhen no globalWorkerexists.Add
output.workerChunkFilenameandentry.workerfor worker chunk filenames.
Patch Changes
Skip re-parsing the inlined entry module when no renaming is needed.
Extend the avoidEntryIife no-parse fast path to multi-entry chunks.
Reuse the binary deserialize dispatch table to speed up cache restore.
Type
buildInfoandbuildMetaper module type with shared common properties.Avoid copying module runtime requirements when ownership is not transferred.
Keep all CommonJS exports when an exported function accesses them via
this.Align CLI color-support detection across Node, Deno and Bun.
Include the schema origin path in conflicting-schema CLI argument errors.
- Security
Reject
__proto__,constructorandprototypepath segments incli.processArgumentsto prevent prototype pollution. Speed up
Compilation.deleteAssetandCompilation.renameAssetvia a lazy reverse index from asset file name to containing chunks.Fix merging of inner modules' top-level declarations in concatenated modules.
Reduce allocations in export hashing and concatenation name lookups.
Avoid toLowerCase allocations in CSS keyword comparisons.
Speed up CSS identifier escaping with a char-class lookup table.
Resolve
[fullhash]inurl()public paths for inlined CSS export types (style/text/css-style-sheet) at runtime.Avoid quadratic line scan when building CSS module exports source maps.
Compute CSS comment source locations lazily.
Support inline hash digest and length in CSS module
localIdentNameplaceholders.Resolve full CSS escapes (including hex) in CSS-Modules names, so e.g.
\75 rl()matchesurl().Reduce CSS parser CPU (hoisted per-call regexes, byte-compared
@containerpure-mode keywords) and stop retaining parsed comments on the reused parser instance between modules.Reduce CSS build time and memory usage. Per-export CSS dependencies are consolidated into one dependency per module, and hot-path allocations and lookups in CSS code generation and the module-graph cache are trimmed.
Cache CSS public-path placeholder offsets per module source to avoid re-materializing and re-scanning the source on every render.
Fix CSS tokenizer infinite loops and dropped tokens on malformed input.
Speed up CSS identifier unescaping with bulk run flushing.
Skip already-visited symlink targets when resolving context hashes so cyclic symlink graphs no longer overflow the queue.
Resolve
DefinePluginaccess to an undefined object member asundefined.Avoid materializing dependency source locations when sorting, keeping them lazy to reduce build time and memory.
Speed up serialization deserialize by replacing a Buffer.isBuffer call with a typeof check.
Emit assets with absolute target paths as-is to avoid invalid Windows paths.
Add
output.environment.spread,output.environment.hasOwn, andoutput.environment.symbol, and use method shorthand, spread,Object.hasOwn, and an unguardedSymbolin generated runtime code where the environment supports it.Drop the unused loadScript runtime from ESM hot-update bundles.
Extend value binding optimization to export default expressions.
Reduce ExportInfo memory and cache size for inline-exports metadata.
Resolve nested exports info paths iteratively to cut per-level array allocations.
Fix stale incremental cache for css, html and asset/source/inline modules.
CommonJS tree-shaking no longer drops exports accessed before a deferred require binding.
Make CSS-referenced asset available in lazy JS chunk during incremental rebuilds.
Correct string/template import specifier parsing for filesystem cache build dependencies and fix module-sharing hostname validation.
Guard isDeferred() behind experiments.deferImport in ConcatenatedModule
Speed up deterministicGrouping and cached comparators on large builds.
Reduce allocations on harmony/commonjs dependency hot paths.
Force-load a module's new owning chunk during HMR when its only loaded chunk is removed from a runtime, so it keeps receiving updates.
Fix HTML parser adoption agency to handle a
nobrshielded by a marker.Expand HTML parser tag/attribute coverage and decode character references.
Speed up and reduce allocations in the experimental HTML parser's tokenizer, tree builder, and entity decoder.
Speed up the experimental HTML parser and reduce its memory usage.
Avoid redundant HTML module work: reuse the dependency-template render across the JS and HTML code-generation passes, and memoize sentinel resolution/content hashing per source.
Release inner-graph state after use and speed up inlined-export checks.
Reduce JavascriptParser allocations on the walk hot path to speed up parsing and lower memory usage.
Reduce CPU and memory overhead of the lazy barrel optimization.
Keep the error message in module build errors on engines whose
Error.stackomits it.Speed up module concatenation by caching repeated per-module computations.
Move the
hotflag fromModuletoNormalModule, where it's actually read and written.Move the
weakflag fromDependencytoModuleDependency, where it's actually set.Avoid the entry IIFE for multiple inlined entry modules by renaming collisions.
Reject
new import.defer(...)/new import.source(...)with member access as a SyntaxError.Avoid
ProvidePlugininjection for local CommonJS require bindings that use the same variable name.Resolve the global
new Worker(new URL(...))toworker_threadson thenodetarget.Use optional chaining in generated runtime code where the environment supports it.
Allow output.path to be the filesystem root by treating EISDIR like EEXIST in mkdirp.
Reduce memory by not retaining the source location object on every dependency.
Keep the full exports object when a
require()binding is re-exported.Replace glob-to-regexp dependency with watchpack's globToRegExp utility.
Shrink the persistent cache: add a NULL_AND_I16 binary tier and inline tiny strings instead of larger far back-references.
Type serializer read/write contexts with positional tuples and fix a ProvideSharedDependency version/request swap.
Speed up buildChunkGraph by deriving block modules from the first runtime.
Cache re-export target resolution in SideEffectsFlagPlugin for faster builds.
Skip pure single-star passthrough modules for
export *re-exports.Skip dependency error/warning reporting for unchanged modules on rebuilds.
Use value descriptors instead of getters for const export bindings.
Apply CSS hot updates on the Node side of a universal target.
Guard CSS
styleexport-type injection so it no-ops when there is nodocument.Avoid building warning stats objects when counting warnings without a filter.
Recognize forward-slash Windows absolute paths (e.g. C:/dir) consistently.
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.