You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 7d49735
Browse filesBrowse the repository at this point in the historyBrowse files
fix: reject a fulfilled async cycle member with the cycle's evaluation error (#21921)
* fix: reject a fulfilled async cycle member with the cycle's evaluation error
A strongly-connected component of async modules records one
[[EvaluationError]] for all of its members, so a member that already
fulfilled before a peer threw must still report that error to a later
import. webpack settled each async module on its own, so importing the
fulfilled member resolved with a half-evaluated namespace.
Async modules in a cycle now hand their peers' ids to the runtime and
mark them on rejection. Both the peer list and the marker are emitted
only under output.strictModuleErrorHandling, which is what makes a
recorded error observable to a later require, so a build without it is
byte-identical.
* perf: name an async cycle by a group key instead of a peer list
Every member of a strongly-connected component carried the ids of all its
peers, so a cycle of five emitted twenty id slots where five keys do. Each
member now emits the component's smallest async member id and the runtime
groups the modules under it, cutting the emitted cost of the cycle-error
propagation by about 70%.
Also stop emitting a blank line and redundant parentheses when
output.strictModuleErrorHandling is off, so a default build is byte-identical.
* fix: key an async cycle group by module id so hot updates do not leak
The cycle group lives for the life of the runtime, so pushing the module
object into it retained every disposed generation once hot replacement
swapped a member, and the error was then recorded on the stale object
instead of the module actually in the cache. The group holds ids now,
deduplicated on entry, and the error is applied through the module cache.
Hot replacement is how most builds reach this path at all, since
HotModuleReplacementPlugin turns output.strictModuleErrorHandling on.
* test: cover a deferred member of an errored async cycle
Reaching a cycle member through a deferred namespace after a peer has
already failed is a different path from importing a fulfilled one: the
deferred import gathers the component's async dependencies, so both it
and the namespace access must report the recorded error. Before the fix
this handed back the member's exports instead.
0 commit comments