Repository navigation
fix: keep multi-compiler options when --config-name or extends rebuild the configuration array - #4871
Conversation
…d the configuration array
🦋 Changeset detectedLatest commit: db8378d 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 (5d4e9e4). Install it locally:
npm i -D webpack-cli@https://pkg.pr.new/webpack-cli@5d4e9e4
yarn add -D webpack-cli@https://pkg.pr.new/webpack-cli@5d4e9e4
pnpm add -D webpack-cli@https://pkg.pr.new/webpack-cli@5d4e9e4 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4871 +/- ##
==========================================
- Coverage 94.98% 94.84% -0.14%
==========================================
Files 14 14
Lines 5598 5626 +28
Branches 840 841 +1
==========================================
+ Hits 5317 5336 +19
- Misses 280 289 +9
Partials 1 1
... and 2 files with indirect coverage changes Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
Walkthrough
Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to
|
Summary
Options for the whole
MultiCompilerare set on the exported configuration array itself:parallelism, andpluginssince webpack/webpack#22702 (which lets a plugin such as webpack-dev-server be applied once to theMultiCompiler).loadConfigrebuilds the array for--config-name,--extendsand configurations usingextends, and the rebuilt array lost those properties, so webpack silently fell back to the defaults. They are now copied over to the rebuilt array.webpackwebpack --config-name first --config-name secondwebpack -c ./extends.config.js(children useextends)webpack --extends ./base.config.jsChecked against webpack/webpack#22702 too: on all those paths, plus arrays of config functions and a promise, a top-level plugin is applied once to the
MultiCompiler.Not covered: several
-cfiles are concatenated into one new array, and there is no obvious rule to merge their array options, so they are still not carried over.What kind of change does this PR introduce?
fix
Did you add tests for your changes?
Yes:
test/build/multi-compiler-options/multi-compiler-options.test.js. A plugin in each child counts how many compilers run at once;parallelismis used because no released webpack has top-levelpluginsyet, and both take the same path. Three of the four cases fail without the fix.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
Written with Claude Code: it reproduced the dropped options with the real CLI, wrote the fix and the test, and checked it against the webpack branch, directed and reviewed by the author.
🤖 Generated with Claude Code
https://claude.ai/code/session_01ML8tLtqrJohECUzhdBwqsw
Generated by Claude Code
Summary by CodeRabbit