fix: concatenated require() in require.ensure or computed target - #21907
Conversation
🦋 Changeset detectedLatest commit: d89e7eb The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
This PR is packaged and the instant preview is available (e1eb099). Install it locally:
npm i -D webpack@https://pkg.pr.new/webpack@e1eb099
yarn add -D webpack@https://pkg.pr.new/webpack@e1eb099
pnpm add -D webpack@https://pkg.pr.new/webpack@e1eb099 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #21907 +/- ##
==========================================
+ Coverage 95.08% 95.09% +0.01%
==========================================
Files 702 703 +1
Lines 90697 90739 +42
Branches 27368 27388 +20
==========================================
+ Hits 86242 86292 +50
+ Misses 4455 4447 -8
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Generated code sizeComparing
1 asset(s) changed size
2 asset(s) this pull request adds
1 runtime(s) changed which runtime modules they carry
Built |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Team Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (8)
💤 Files with no reviewable changes (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughChangesCommonJS require concatenation
Suggested labels: Merge Risk: ⚪ Minimal · up to This PR fixes concatenated CommonJS require handling in asynchronous callbacks and computed targets with accompanying tests; no actionable merge-blocking risk remains beyond normal checks and review. 🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (3 passed)
Full details: Title checkExplanation The title uses the required Conventional Commit form with the allowed type Full details: Linked Issues checkExplanation The changes directly address issue
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Merging this PR will improve performance by 43.11%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ⚡ | Memory | benchmark "wasm-modules-sync", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}' |
349.9 KB | 210.3 KB | +66.34% |
| ⚡ | Memory | benchmark "future-defaults", scenario '{"name":"mode-production","mode":"production"}' |
10.7 MB | 8.7 MB | +23.12% |
Tip
Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.
Comparing fix/concat-require-header-in-async-block (d89e7eb) with main (c50713c)1
Summary
Fixes #21903.
In concatenation,
RequireHeaderDependencyskipped renderingrequirecallee only after the paired CJS require dependency had replaced the whole call andregisterReplacedRequire.But inside a
require.ensureand AMD callback, the CJS require dependency sits in the async block, whichJavascriptGeneratorrenders it after the module's presentational dependencies, so the renderingRequireHeaderDependencycan't be skipped, which cause module reference error.Now
RequireHeaderDependencyrely onCommonJsRequireDependnecy#rendersAsConcatenatedReferencedirectly, it won't introduce order issues.What kind of change does this PR introduce?
fix
Did you add tests for your changes?
Yes
Does this PR introduce a breaking change?
No
If relevant, what needs to be documented once your changes are merged or what have you already documented?
n/a
Use of AI
Yes
Summary by CodeRabbit
Bug Fixes
require()calls inside asynchronous loading callbacks and computed module requests.Tests
Release