Skip to content

fix: sourceTypes of asset module when lazy compilation#19539

Merged
alexander-akait merged 1 commit intowebpack:mainfrom
hai-x:fix-asset-type
May 20, 2025
Merged

fix: sourceTypes of asset module when lazy compilation#19539
alexander-akait merged 1 commit intowebpack:mainfrom
hai-x:fix-asset-type

Conversation

@hai-x
Copy link
Member

@hai-x hai-x commented May 16, 2025

What kind of change does this PR introduce?

Fixes #19532.

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

@hai-x
Copy link
Member Author

hai-x commented May 16, 2025

In lib/ModuleTypeConstants.js, we define some module types that are neither javascript/* nor css/*.

To ensure robust module connections, I propose defaulting to JS_TYPES or JS_AND_ASSET_TYPES.

@codspeed-hq
Copy link

codspeed-hq bot commented May 16, 2025

CodSpeed Performance Report

Merging #19539 will degrade performances by 81.73%

Comparing hai-x:fix-asset-type (2accb4b) with main (843f788)

Summary

⚡ 82 improvements
❌ 4 regressions
✅ 47 untouched benchmarks

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

Benchmarks breakdown

Benchmark BASE HEAD Change
benchmark "devtool-eval", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}' 35.2 ms 42.6 ms -17.27%
benchmark "devtool-source-map", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}' 11.5 ms 10.4 ms +10.73%
benchmark "lodash", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}' 11.3 ms 34.5 ms -67.24%
benchmark "many-chunks-commonjs", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}' 11.2 ms 61.4 ms -81.73%
benchmark "many-chunks-esm", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}' 11.3 ms 61.8 ms -81.64%
benchmark "react", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}' 35.1 ms 11.1 ms ×3.2
md4 buffer benchmark (size: 10000) 114.1 µs 73.1 µs +56.11%
md4 buffer benchmark (size: 100000) 447.5 µs 406.6 µs +10.04%
md4 buffer benchmark (size: 120) 75.9 µs 35 µs ×2.2
md4 buffer benchmark (size: 160) 76.1 µs 35.1 µs ×2.2
md4 buffer benchmark (size: 16366) 138.5 µs 97.4 µs +42.19%
md4 buffer benchmark (size: 16368) 138.5 µs 97.5 µs +42.04%
md4 buffer benchmark (size: 16370) 138.5 µs 97.5 µs +42.1%
md4 buffer benchmark (size: 2) 76.3 µs 35.1 µs ×2.2
md4 buffer benchmark (size: 20) 76.4 µs 32.7 µs ×2.3
md4 buffer benchmark (size: 200) 76.3 µs 35.2 µs ×2.2
md4 buffer benchmark (size: 2000) 81.9 µs 40.8 µs ×2
md4 buffer benchmark (size: 20000) 152.7 µs 111.5 µs +36.91%
md4 buffer benchmark (size: 2002) 81.9 µs 40.8 µs ×2
md4 buffer benchmark (size: 40) 73.6 µs 32.6 µs ×2.3
... ... ... ... ...

ℹ️ Only the first 20 benchmarks are displayed. Go to the app to view all benchmarks.

@hai-x hai-x marked this pull request as ready for review May 16, 2025 16:21
@alexander-akait alexander-akait merged commit 2c4f967 into webpack:main May 20, 2025
63 of 65 checks passed
@hai-x hai-x deleted the fix-asset-type branch June 1, 2025 05:10
3ru pushed a commit to 3ru/webpack that referenced this pull request Jul 1, 2025
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.

[experiments.lazyCompilation] import()ing asset modules will fail

2 participants