Patch Changes
-
Reduce per-file overhead in
ContextModuleFactory.resolveDependenciesby batchingalternativeRequestshook calls. Previously the hook was invoked once per file in the context (with a single-item array), paying per-call overhead (closure allocation,resolverFactory.get, intermediate arrays inRequireContextPlugin) for every file. The hook is now invoked once per directory with all matched files in one batch —RequireContextPlugin's tap already iterates the items array, so the output is unchanged. Steady-state rebuild on a 4000-filerequire.contextdrops a further ~15 ms (after the watch-mode purge fix in the same release). (by @alexander-akait in #21020) -
Include each external info's
runtimeConditioninConcatenatedModule#updateHashso changes to a concatenated external's runtime condition invalidate persistent caches instead of slipping through with the module id alone. (by @alexander-akait in #21023) -
Fix HTML
[contenthash]for referenced asset and inline-style URL changes. (by @alexander-akait in #21018) -
Resolve chunk-hash placeholders in chunk URLs embedded into extracted HTML. (by @alexander-akait in #21018)
-
Remove unnecessary
__webpack_require__runtime helpers in ESM library output with multi-module chunks. (by @xiaoxiaojx in #21032) -
Rewrite
NormalModule#getSideEffectsConnectionStatewalk as an allocation-light iterative loop instead of a generator trampoline, restoring rebuild performance lost in #20993 while keeping deep import chains stack-safe. (by @alexander-akait in #21014) -
Fix runtime
ReferenceErroron the first activation of a lazy-compiled module whenoutput.library.typeproduces a closure-wrapped bundle (umd,umd2,amd,amd-require,system). (by @alexander-akait in #21013)External modules of these types reference closure-bound identifiers like
__WEBPACK_EXTERNAL_MODULE_react__, supplied by the library wrapper that is generated once per chunk. WhenlazyCompilationactivates an entry or import for the first time, any external dependency the lazily-built module pulls in arrives in a hot-update chunk that lives outside the original wrapper closure, so its factory body cannot resolve the closure identifier and only a manual page refresh recovers.The inactive
LazyCompilationProxyModulenow declares statically-enumerable externals (string and object forms ofexternals) as its own dependencies, so the initial entry chunk's library wrapper already exposes their closure identifiers. When activation later pulls in those externals through the lazily-compiled module, they resolve to the already-installed factories instead of throwing. Function and RegExp externals are not pre-populated because their effective request set isn't knowable up front. -
Fill in missing
entryOptionswhen an async block joins an existing entrypoint. (by @alexander-akait in #21026) -
Release per-child
codeGenerationResultsinMultiCompilerand atCompiler.closeto reduce memory retention. (by @alexander-akait in #21015) -
Reduce peak memory of
SourceMapDevToolPluginon large builds (closes #20961). (by @alexander-akait in #20963) -
Fix slow
require.context()/ dynamicimport()rebuilds in watch mode (#13636). When a file inside a watched context directory changed,NodeWatchFileSystemwould callinputFileSystem.purge(contextDir). The enhanced-resolvepurgeimplementation matches cache keys withkey.startsWith(contextDir), so the stat cache of every file under the directory was discarded on every rebuild —ContextModuleFactory.resolveDependenciesthen re-stat-ed the whole tree on each rebuild. Single-file rebuilds on a 4000-file context now reuse the warm stat cache, dropping median rebuild from ~1260 ms to ~650 ms in a local reproduction (≈49%). For directory items that are explicitly watched contexts,purgeis now called with{ exact: true }(added inenhanced-resolve@5.22.0) so only the directory's own entry is invalidated; file-level changes in the same aggregated event continue to purge file stats and the parentreaddiras before. (by @alexander-akait in #21020)