Skip to content

fix: should emit assets even if invalidation occurs again#19756

Merged
alexander-akait merged 2 commits into
mainfrom
fix-invalidate-missing-asset-emit
Aug 4, 2025
Merged

fix: should emit assets even if invalidation occurs again#19756
alexander-akait merged 2 commits into
mainfrom
fix-invalidate-missing-asset-emit

Conversation

@hai-x

@hai-x hai-x commented Aug 1, 2025

Copy link
Copy Markdown
Member

What kind of change does this PR introduce?

Fixes #15541. The issue is about two invalidations in quick succession.

We should emit assets even if invalidation occurs again.

In the case of above issue, hot update manifest is only generated during the first compilation triggered by the initial invalidation.

If we skip emitting assets (in particular hot update manifest ) in the first compilation, it will cause HMR failed, resulting in a full reload.

Assets of first compilation

0 = {name: 'bundle.js', source: CachedSource, info: {…}}
1 = {name: 'simple-entry_js.bundle.js', source: CachedSource, info: {…}}
2 = {name: 'a_js_lazy-compilation-proxy.bundle.js', source: CachedSource, info: {…}}
3 = {name: 'b_js_lazy-compilation-proxy.bundle.js', source: CachedSource, info: {…}}
4 = {name: 'c_js_lazy-compilation-proxy.bundle.js', source: CachedSource, info: {…}}
5 = {name: 'a_js.bundle.js', source: CachedSource, info: {…}}
6 = {name: 'b_js.bundle.js', source: CachedSource, info: {…}}
7 = {name: 'c_js.bundle.js', source: CachedSource, info: {…}}
8 = {name: 'main.88504f5b514c1ccfba96.hot-update.js', source: ConcatSource, info: {…}}
9 = {name: 'a_js_lazy-compilation-proxy.88504f5b514c1ccfba96.hot-update.js', source: ConcatSource, info: {…}}
10 = {name: 'b_js_lazy-compilation-proxy.88504f5b514c1ccfba96.hot-update.js', source: ConcatSource, info: {…}}
11 = {name: 'c_js_lazy-compilation-proxy.88504f5b514c1ccfba96.hot-update.js', source: ConcatSource, info: {…}}
12 = {name: 'main.88504f5b514c1ccfba96.hot-update.json', source: RawSource, info: {…}}

Assets of second compilation

0 = {name: 'bundle.js', source: CachedSource, info: {…}}
1 = {name: 'simple-entry_js.bundle.js', source: CachedSource, info: {…}}
2 = {name: 'a_js_lazy-compilation-proxy.bundle.js', source: CachedSource, info: {…}}
3 = {name: 'b_js_lazy-compilation-proxy.bundle.js', source: CachedSource, info: {…}}
4 = {name: 'c_js_lazy-compilation-proxy.bundle.js', source: CachedSource, info: {…}}
5 = {name: 'a_js.bundle.js', source: CachedSource, info: {…}}
6 = {name: 'b_js.bundle.js', source: CachedSource, info: {…}}
7 = {name: 'c_js.bundle.js', source: CachedSource, info: {…}}

Did you add tests for your changes?

Yes

Does this PR introduce a breaking change?

No

What needs to be documented once your changes are merged?

No

@codspeed-hq

codspeed-hq Bot commented Aug 1, 2025

Copy link
Copy Markdown

CodSpeed Performance Report

Merging #19756 will degrade performances by 34.06%

Comparing fix-invalidate-missing-asset-emit (6595ec8) with main (de79ee4)

Summary

⚡ 1 improvements
❌ 2 regressions
✅ 39 untouched benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark BASE HEAD Change
benchmark "cache-filesystem", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}' 232.5 ms 352.6 ms -34.06%
benchmark "many-modules-commonjs", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}' 93.7 ms 128.7 ms -27.24%
benchmark "three-long", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}' 230.1 ms 12 ms ×19

@hai-x hai-x marked this pull request as ready for review August 1, 2025 20:05
@alexander-akait alexander-akait merged commit 9a3c4f9 into main Aug 4, 2025
42 of 44 checks passed
@alexander-akait alexander-akait deleted the fix-invalidate-missing-asset-emit branch August 4, 2025 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Lazy compilation can fail when switching "routes" quickly

2 participants