- Wrap concatenated modules in lazy __webpack_require__.cw accessors and inline require(), keeping a wrapped body's names and side effects intact
- Add performance hints reporting what a build costs: duplicate packages and modules, circular dependencies, broad contexts, large modules and chunks, hotspots, eval, missing PURE annotations, polyfills, redundant dynamic imports, OS-dependent rules, cache effectiveness, how chunks load, what splitting refused, why an optimization was skipped, and rules, defines, externals, aliases and barrel reexports nothing uses
- Add the descriptionRelativePath module rule condition
- Add OS-independent glob matching to module rules
- Report inner-graph, AMD and bare module bailouts in optimizationBailout
- Allow marking externals as side-effect-free with a sideEffects flag
- Give externals the original request of a context module element
- Add the externalsPresets.nodeModules preset with an allowlist option to externalize installed packages
- Add output.library.umdAmdContainer for an AMD-style loader branch in UMD
- Resolve @custom-media values that are true / false or name another custom media
- Add the __webpack_css_server_styles__ module variable to read the CSS collected while rendering without a DOM
- Emit analyzable ESM urls for chunks, assets, styles, workers and wasm
- Patch the HTML <head> in place on hot update instead of forcing a full reload
- Scope counter names in CSS modules and fix the counter() counter-style and animation timeline keywords
- Derive import defer / import source from the target and fix the source phase
- Tree shake CommonJS: module.exports object literals, exports destructured from a require() binding, unused method requires, and unused side-effect-free require() calls and reexports
- Resolve relative entry baseUri values and bake one side of a hash cycle
- Minify CSS further with advanced transformations including shorthands, keywords, colors, numbers, times, calc() and other math functions, selector lists, An+B, keyframe selectors, media-feature ranges, unicode-range, transition layers, display, transforms, gradients, font families, and dead rule elimination
- Safely minify CSS and HTML assets when optimization.minimize is enabled unless a minimizer is already configured
From webpack
Minor Changes
-
Wrap concatenated modules in lazy
__webpack_require__.cwaccessors and inlinerequire(), keeping a wrapped body's names and side effects intact. (by @hai-x in #21519) -
Add performance hints reporting what a build costs: duplicate packages and modules, circular dependencies, broad contexts, large modules and chunks, hotspots,
eval, missing PURE annotations, polyfills, redundant dynamic imports, OS-dependent rules, cache effectiveness, how chunks load, what splitting refused, why an optimization was skipped, and rules, defines, externals, aliases and barrel reexports nothing uses. An oversized asset names its largest modules, and an entrypoint carrying the runtime recommendsoptimization.runtimeChunk. Enable every check not set individually withperformance.all, report hints in stats only withperformance.hints: "stats", and get them in a stable order that leaves the build hashes unchanged. (by @alexander-akait in #21841) -
Add the
descriptionRelativePathmodule rule condition. (by @alexander-akait in #21705) -
Add OS-independent
globmatching to module rules. (by @alexander-akait in #21771) -
Report inner-graph, AMD and bare
modulebailouts inoptimizationBailout. (by @alexander-akait in #21740) -
Allow marking externals as side-effect-free with a
sideEffectsflag. (by @alexander-akait in #21712) -
Give externals the original request of a context module element. (by @alexander-akait in #21780)
-
Add the
externalsPresets.nodeModulespreset with anallowlistoption to externalize installed packages, replacing thewebpack-node-externalsplugin. (by @alexander-akait in #21569) -
Add
output.library.umdAmdContainerfor an AMD-style loader branch in UMD. (by @hai-x in #21770) -
Resolve
@custom-mediavalues that aretrue/falseor name another custom media. (by @alexander-akait in #21624) -
Add the
__webpack_css_server_styles__module variable to read the CSS collected while rendering without a DOM, and keep that CSS in the order the styles were applied. (by @alexander-akait in #21576) -
Patch the HTML
<head>in place on hot update instead of forcing a full reload, including when a<script>that never executed is removed. (by @alexander-akait in #21624) -
Scope counter names in CSS modules; fix the
counter()counter-style andanimationtimeline keywords. (by @alexander-akait in #21600) -
Derive
import defer/import sourcefrom the target and fix the source phase. (by @alexander-akait in #21810) -
Emit analyzable ESM urls for chunks, assets, styles, workers and wasm. (by @alexander-akait in #21788)
-
Tree shake CommonJS:
module.exportsobject literals, exports destructured from arequire()binding, unused method requires, and unused side-effect-freerequire()calls and reexports. (by @alexander-akait in #21841) -
Resolve relative entry
baseUrivalues and bake one side of a hash cycle. (by @alexander-akait in #21750) -
Minify CSS further, only where the document is unchanged: shorthands and box longhands,
font-weight,<position>andfont-stretchkeywords, colors (polar, Lab andhsl()converted to hex), numbers, times, zero units,calc()and every math function the spec names folded over constants, selector lists, An+B, keyframe selectors, media-feature ranges,unicode-range,transitionlayers,display, transforms, gradients, font families, identical repeated declarations, and rules an identical later one makes dead. Abilities are read off the target browsers,vendorPrefixesadds and drops vendor prefixes for them, andrewriteCustomPropertiesshortens custom property values. Minification never changes whether a declaration parses, and beautifying keeps every rule. (by @alexander-akait in #21841) -
Safely minify CSS (with source maps) and HTML assets when
optimization.minimizeis enabled, unless a minimizer is already configured for them, making only transformations an engine cannot tell apart. Every rewrite is named as an option, so it can be switched off. (by @alexander-akait in #21841) -
Minify HTML further where the parsed document is unchanged: drop redundant quotes, whitespace nothing renders, escapes text does not need, implied tags, optional end tags nothing prints behind, empty attributes and nested empty elements; fold enumerated values and casing; normalize each attribute against the element it is on; and rewrite
style, token lists,srcset,sizes, URL, integer and boolean attributes, viewportcontent, inline<style>and a JSON<script>body through their own grammars. Adds theoptimization.minimize.htmloptionscollapseWhitespace,mergeStyles,minifyConditionalComments,minifySrcdoc,preserveComments,removeEmptyAttributes,removeEmptyElements,removeImpliedTags,removeRedundantAttributes,sortAttributesandsortTokenLists, and keeps an end tag the parent, the next element or the adoption agency would otherwise restructure the tree over. (by @alexander-akait in #21841) -
Suggest the closest name or a casing fix anywhere in a failed request. (by @alexander-akait in #21727)
-
Add aggregated
shutdownhook toMultiCompiler. (by @bjohansebas in #21578) -
Report which compilers changed on the MultiCompiler
donehook. (by @bjohansebas in #21580) -
Add
[containedpath]/[containedfile]placeholders, used for[path]/[file]of asset and html modules withexperiments.futureDefaults. (by @alexander-akait in #21592) -
Support an object for an entry's
htmlthat overridesoutput.htmlper option. (by @alexander-akait in #21574) -
Configure or exclude each asset type's minifier via
optimization.minimize. (by @alexander-akait in #21663) -
Support printing CSS and HTML beautified as well as minified. (by @alexander-akait in #21660)
-
Add
renderEmbeddedSource, and minify what it offers out of the box. (by @alexander-akait in #21830) -
Report bindings named
eval,argumentsor reserved words in ES module output. (by @alexander-akait in #21567) -
Emit no development source map for module libraries, or any with futureDefaults. (by @alexander-akait in #21839)
-
Speed up builds and cut memory: faster CSS, HTML and JavaScript parsing and minification, a built-in scope analyzer replacing
eslint-scope, faster dependency hot paths, module diagnostics, CommonJS export scanning and concatenated module renaming, runtime modules, parsers, generators and dependencies loaded only when used, one file watcher pool shared between MultiCompiler children, and lower parser, graph and startup memory. (by @alexander-akait in #21841) -
Improve tree-shaking for a namespace reexported as default, and fix
import d from "./mod"; d.memberreadingundefinedin that case. (by @alexander-akait in #21841) -
Warn on cross-kind CSS module export conflicts and let the class win. (by @alexander-akait in #21538)
-
Add
output.resourceHints.dedupeto skip prefetch links for already preloaded/prefetched chunks. (by @alexander-akait in #21386)
Patch Changes
-
Let a memory-cache etag mismatch fall through to the file cache instead of reporting a miss. (by @alexander-akait in #21624)
-
Determine provided exports in dependency order, so a build's module hashes no longer depend on what the persistent cache held. (by @alexander-akait in #21630)
-
Emit no dead module and no failing require for an
asset-urlexternal. (by @alexander-akait in #21713) -
Fix names, hidden devtools and cache reuse for CSS maps inlined into JS. (by @alexander-akait in #21558)
-
Follow the HTML spec more closely when parsing and printing: frameset content, quirks paragraphs and selects,
<![CDATA[outside foreign content as a bogus comment,<?target data?>as a processing instruction,</>dropped, comment data and DOCTYPE identifiers read from the tokenizer states, attributes merged from a repeated<html>/<body>tag, legacy JavaScript script types, voidkeygenand font format detection — and hand back the tree a parsed document was built from when printing it. (by @alexander-akait in #21841) -
Clear a
Watching'sblockedflag when its build starts, so it reports only a child actually waiting for its MultiCompiler parent. (by @bjohansebas in #21639) -
Fix AMD
define()output using the wrong module and exports argument names. (by @hai-x in #21814) -
Fix
ReferenceErrorfromimport.meta.mainusing the wrong module argument. (by @hai-x in #21620) -
Leave a
@namespaceURI alone instead of resolving and rewriting it as an asset. (by @alexander-akait in #21658) -
Resolve escaped CSS names, and scope a grid area cell name as one name. (by @alexander-akait in #21665)
-
Track exports usage of side-effect-free modules an active import() evaluates. (by @hai-x in #21623)
-
Resolve absolute symlink targets and treat an unreadable context as missing. (by @alexander-akait in #21647)
-
Fix corrupted icon URLs in a
.webmanifestwith a BOM or non-ASCII text. (by @alexander-akait in #21655) -
Respect
strictThisContextOnImportsforrequire()member calls. (by @hai-x in #21601) -
Fix
import.meta,[object Object]asset urls and crashes in build-time executed modules. (by @alexander-akait in #21841) -
Inherit sideEffects past a type-only nested package.json for files under node_modules. (by @xiaoxiaojx in #21686)
-
Do not fail directory creation when the file system reports it already exists. (by @alexander-akait in #21698)
-
Fix top-level
usingandawait usingdeclarations in modules. (by @alexander-akait in #21557) -
Fix
DefinePluginoptional chains reading an undefined object member. (by @lazerg in #21823) -
Fix MultiCompiler: compute the common
outputPathby whole path segments, run again after a dependency validation failure, and recover watch mode from a fatal child error without leaking watchings. (by @alexander-akait in #21841) -
Keep a nested bundle's runtime tables separate when bundling webpack output. (by @alexander-akait in #21568)
-
Keep the runtime out of strict mode when
output.globalObjectreadsthis. (by @alexander-akait in #21715) -
Run an even-priority
__webpack_require__.Ohandler without waiting. (by @alexander-akait in #21803) -
Treat top-level
thisin a classic worker entry as its global scope. (by @alexander-akait in #21720) -
Rehash runtime modules whose code changes under a content-named filename. (by @alexander-akait in #21828)
-
Fix namespace object reexports and string export names in module library output and emit a CommonJS entry's default as
export default. (by @alexander-akait in #21589) -
Keep tree-shaken JSON arrays as arrays when a prototype property is read. (by @hai-x in #21599)
-
Generate every CSS and HTML lookup table into
lib/{css,html}/data.jsfrommdn-data,color-nameand the spec IDL — including the value-type facts read out of the CSS value-definition grammars — leaving bothsyntax.jsfiles algorithm only. (by @alexander-akait in #21841) -
Support UNC paths in module and context replacement plugins. (by @avivkeller in #21645)
-
Emit less runtime code: shorter syntax where
output.environmentallows, no IIFE for aRuntimeModulewithout locals, no unread__webpack_esm_id__andexports.idchunk exports, and an ESM entry chunk installing its own modules from its local bindings instead of importing itself. (by @alexander-akait in #21841) -
Release the compilation and file system caches retained after
compiler.close(). (by @alexander-akait in #21603)