Repository navigation
fix(optimize): reject concatenateModules with cacheUnaffected again - #22744
Conversation
🦋 Changeset detectedLatest commit: 4fa17b2 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 (36f36bc). Install it locally:
npm i -D webpack@https://pkg.pr.new/webpack@36f36bc
yarn add -D webpack@https://pkg.pr.new/webpack@36f36bc
pnpm add -D webpack@https://pkg.pr.new/webpack@36f36bc |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Change: Bug fix Merge Risk: ⚪ Minimal · up to
|
Types CoverageCoverage after merging fix/concatenation-cache-unaffected-guard into main will be
Coverage Report |
Generated code sizeComparing base (
Read No asset changed size. No runtime gained or lost a runtime module. Built |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #22744 +/- ##
==========================================
+ Coverage 95.98% 96.45% +0.47%
==========================================
Files 778 778
Lines 136313 136313
Branches 46009 46009
==========================================
+ Hits 130837 131481 +644
+ Misses 5476 4832 -644
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:
|
Summary
ModuleConcatenationPluginis meant to refuseexperiments.cacheUnaffected, the same wayusedExportsandmangleExportsdo. But it checkedcompilation.moduleMemCachesin thecompilationhook, and that field is only set later, in_computeAffectedModules. So the check never fired, and watch mode could emit a broken bundle. The check now runs inoptimizeChunkModules.Found while checking the skipped
WatchCacheUnaffectedTestCases. Thecache/asset-concatwatch case undercacheUnaffected, without its filter:TypeError: __webpack_modules__[moduleId] is not a functionoptimization.concatenateModules can't be used with cacheUnaffected as module concatenation is a global effectTest filters:
cache/add-defines: filter removed; it passes undercacheUnaffected.cache/asset-concat: comment added saying why it is filtered.scope-hoisting/caching-inner-sourceandplugins/dll-reference-plugin: filtered the same way. They enable concatenation explicitly and were running this unsupported combination unnoticed.What kind of change does this PR introduce?
fix
Did you add tests for your changes?
Yes, in
test/unitCases/Compiler.unittest.js. The new test fails without the fix. The watch-case filters are updated as above.Does this PR introduce a breaking change?
No. The combination was already documented as unsupported; it now reports the error it was meant to.
If relevant, what needs to be documented once your changes are merged or what have you already documented?
n/a
Use of AI
Claude Code investigated the skipped tests, found the cause, wrote the fix and the test, and ran the watch, config and unit suites locally; I reviewed the change.
Generated by Claude Code
Summary by CodeRabbit
cacheUnaffectednow report an error when module concatenation is enabled. The error is reported during module optimization rather than during compilation setup, while the incompatible combination remains unsupported.