Allow webpack-cli v7 in peer dependencies#1021
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughRaised webpack minimum to ^5.101.0, added ^7.0.0 support for webpack-cli, constrained webpack-dev-server to ^5.2.2 across manifests and docs; bumped dev webpack to 5.101.3; adjusted CI workflow quoting and TypeScript flags; renamed several Jest mock constructors in a test; added CHANGELOG entry. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Autofix Details
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Install template not updated for webpack-cli v7
- Updated
lib/install/package.jsonso the installer’s webpack dependency template now includes the^7.0.0range forwebpack-cli, matching the root package and docs.
- Updated
Or push these changes by commenting:
@cursor push 5588702eb4
Preview (5588702eb4)
diff --git a/lib/install/package.json b/lib/install/package.json
--- a/lib/install/package.json
+++ b/lib/install/package.json
@@ -9,7 +9,7 @@
"terser-webpack-plugin": "^5.3.1",
"webpack": "^5.76.0",
"webpack-assets-manifest": "^5.0.6 || ^6.0.0",
- "webpack-cli": "^4.9.2 || ^5.0.0 || ^6.0.0",
+ "webpack-cli": "^4.9.2 || ^5.0.0 || ^6.0.0 || ^7.0.0",
"webpack-dev-server": "^4.15.2 || ^5.2.2",
"webpack-merge": "^5.8.0 || ^6.0.0",
"webpack-subresource-integrity": "^5.1.0"
Greptile SummaryThis PR extends the Key points to be aware of:
Confidence Score: 4/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[User installs shakapacker] --> B{Which webpack-cli version?}
B --> C[v4 / v5 / v6]
B --> D[v7 - NEW in this PR]
C --> E[Works with webpack-dev-server v4 or v5]
D --> F{Which webpack-dev-server?}
F --> G[v5 - OK]
F --> H[v4 - Runtime failure\nwds@v4 dropped in cli@v7]
D --> I{Which webpack version?}
I --> J[>= 5.82.0 - OK]
I --> K[5.76 - 5.81 - May fail\ncli@v7 requires >= 5.82.0]
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@package.json`:
- Line 121: The lib/install package.json is missing the same webpack-cli version
range as the main package; update the webpack-cli entry in that package.json
(the "webpack-cli" dependency/peerDependencies line) to include "^7.0.0"
alongside the existing ranges (i.e., "^4.9.2 || ^5.0.0 || ^6.0.0 || ^7.0.0") so
the version constraints match the main package.json; verify the change by
checking the "webpack-cli" key in the package.json for consistency.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 08937aaf-f166-4c08-92e7-337b0d041190
📒 Files selected for processing (3)
CHANGELOG.mddocs/peer-dependencies.mdpackage.json
ReviewThe core change is correct. Two gaps worth fixing before merge: 1. lib/install/package.json not updated (important) Line 12 still reads webpack-cli: ^4.9.2 || ^5.0.0 || ^6.0.0 - missing ^7.0.0. This is the template used by the install generator, so new projects will not get v7 support. Should be updated to include || ^7.0.0. 2. lib/shakapacker/doctor.rb stale version string (minor) Line 277 reads webpack-cli => ^4.9.2 || ^5.0.0. This appears in the missing dependency warning and is already missing v6 and now v7. Does not affect validation logic but is misleading. Worth updating to match the full supported range. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 141b20774d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Two gaps worth fixing before merge. (1) lib/install/package.json line 12 still reads webpack-cli ^4.9.2 || ^5.0.0 || ^6.0.0 - this is the template used by rails shakapacker:install so new projects will not get v7. (2) lib/shakapacker/doctor.rb line 277 has the stale string webpack-cli => ^4.9.2 || ^5.0.0 in the missing-dependency warning shown to users - it already missed v6 and now misses v7. Worth noting: devDependencies is still ^6.0.0 so CI is not exercising v7 yet. |
|
Addressed the follow-up compatibility items in this PR as well:
This should close out the remaining compatibility concerns raised in review. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0a1d2b48d4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
🧹 Nitpick comments (1)
package.json (1)
122-122: Add webpack-dev-server version validation to doctor.rb.Dropping webpack-dev-server v4 support is a breaking change.
lib/shakapacker/doctor.rbvalidates webpack and webpack-cli versions but does not validate webpack-dev-server. Users still on v4 will receive npm/yarn peer dependency warnings but will silently passshakapacker:doctor, potentially leading to runtime issues. Consider adding webpack-dev-server to the validation incheck_webpack_peer_deps.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@package.json` at line 122, The doctor.rb check_webpack_peer_deps currently validates webpack and webpack-cli but omits webpack-dev-server; update lib/shakapacker/doctor.rb inside the check_webpack_peer_deps method to also detect and validate the installed webpack-dev-server version (e.g., ensure it is ^5.x and treat ^4.x as unsupported), surface a clear error/warning via the same reporting path used for webpack and webpack-cli (including the actual installed version and recommended range), and add/update any related tests to cover a v4 installation case so users running v4 no longer pass shakapacker:doctor silently.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@package.json`:
- Line 122: The doctor.rb check_webpack_peer_deps currently validates webpack
and webpack-cli but omits webpack-dev-server; update lib/shakapacker/doctor.rb
inside the check_webpack_peer_deps method to also detect and validate the
installed webpack-dev-server version (e.g., ensure it is ^5.x and treat ^4.x as
unsupported), surface a clear error/warning via the same reporting path used for
webpack and webpack-cli (including the actual installed version and recommended
range), and add/update any related tests to cover a v4 installation case so
users running v4 no longer pass shakapacker:doctor silently.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 8e52bcab-8bef-464d-985a-66b6473d69b3
⛔ Files ignored due to path filters (3)
spec/dummy/package-lock.jsonis excluded by!**/package-lock.jsonspec/dummy/yarn.lockis excluded by!**/yarn.lock,!**/*.lockyarn.lockis excluded by!**/yarn.lock,!**/*.lock
📒 Files selected for processing (9)
CHANGELOG.mdREADME.mddocs/optional-peer-dependencies.mddocs/peer-dependencies.mddocs/v9_upgrade.mdlib/install/package.jsonlib/shakapacker/doctor.rbpackage.jsonspec/dummy/package.json
✅ Files skipped from review due to trivial changes (7)
- docs/v9_upgrade.md
- spec/dummy/package.json
- README.md
- docs/optional-peer-dependencies.md
- lib/shakapacker/doctor.rb
- CHANGELOG.md
- lib/install/package.json
🚧 Files skipped from review as they are similar to previous changes (1)
- docs/peer-dependencies.md
0a1d2b4 to
f4dc463
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f4dc463144
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Review summary posted as inline comments. See discussion threads on CHANGELOG.md, README.md, docs/v9_upgrade.md, test/package/bundlerUtils.rspack.test.js, and .github/workflows/trigger-docs-site.yml for specifics. |
|
Review: Allow webpack-cli v7 in peer dependencies The core change is straightforward and well-executed. A few issues worth addressing: Breaking change: webpack-dev-server v4 dropped without documentation The range changed from Node.js version implication not documented webpack-cli v7 requires Node >= 20.9.0 (its README and upgrade docs still show stale version examples README.md (lines ~259-260 and ~277-278) and docs/v9_upgrade.md (lines ~341-342) still show webpack-cli ^5.0.0 and webpack-dev-server ^5.0.0 in their example snippets, inconsistent with the updated peer dependency ranges. --ignoreDeprecations 6.0 suppresses warnings rather than fixing them The TypeScript flag added to the CI type-check job silences TypeScript 6.0 deprecation warnings instead of resolving them. This is fine as a short-term workaround (--moduleResolution node is deprecated in favour of bundler), but worth a follow-up issue to migrate the .d.ts type-check to a supported resolution mode. |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/node.yml:
- Around line 143-145: Replace the suppression of the TypeScript deprecation
warning (--ignoreDeprecations 6.0) with a real fix: update tsconfig.json's
"moduleResolution" from the deprecated "node" (which maps to node10) to a
current option such as "node16" or "nodenext" and remove the
--ignoreDeprecations flag in the workflow; if node10 compatibility is
intentional, leave the workflow but add a clear inline comment in tsconfig.json
explaining why "node10" compatibility is required and when you expect to revisit
it before TypeScript 7.0.
In `@package.json`:
- Line 122: The config currently advertises "webpack-dev-server": "^5.2.2" but
package/webpackDevServerConfig.ts still uses the removed hooks
onBeforeSetupMiddleware and onAfterSetupMiddleware; remove those keys or migrate
them into the v5 setupMiddlewares hook by adapting their handlers to receive
(middlewares, devServer) and then insert the former "before" middleware with
middlewares.unshift(...) and the former "after" middleware with
middlewares.push(...). Update or remove the onBeforeSetupMiddleware and
onAfterSetupMiddleware exports/usages so only setupMiddlewares is present and
wired to the existing middleware functions.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: c2cf3c7b-ef2b-44a4-9da9-f01fc9dc463b
⛔ Files ignored due to path filters (3)
spec/dummy/package-lock.jsonis excluded by!**/package-lock.jsonspec/dummy/yarn.lockis excluded by!**/yarn.lock,!**/*.lockyarn.lockis excluded by!**/yarn.lock,!**/*.lock
📒 Files selected for processing (13)
.github/workflows/dummy.yml.github/workflows/node.yml.github/workflows/trigger-docs-site.ymlCHANGELOG.mdREADME.mddocs/optional-peer-dependencies.mddocs/peer-dependencies.mddocs/v9_upgrade.mdlib/install/package.jsonlib/shakapacker/doctor.rbpackage.jsonspec/dummy/package.jsontest/package/bundlerUtils.rspack.test.js
💤 Files with no reviewable changes (1)
- .github/workflows/dummy.yml
✅ Files skipped from review due to trivial changes (7)
- .github/workflows/trigger-docs-site.yml
- docs/v9_upgrade.md
- README.md
- CHANGELOG.md
- docs/optional-peer-dependencies.md
- test/package/bundlerUtils.rspack.test.js
- docs/peer-dependencies.md
🚧 Files skipped from review as they are similar to previous changes (3)
- spec/dummy/package.json
- lib/shakapacker/doctor.rb
- lib/install/package.json
…plicitly - README and v9_upgrade.md now show webpack-cli ^6.0.0 in example snippets (matching the installer default for Node 20.0–20.8), with a note that v7 is available on Node >= 20.9.0. - webpackDevServerConfig.ts now explicitly deletes deprecated on_before_setup_middleware / on_after_setup_middleware keys after warning, rather than relying on implicit filtering downstream. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Code ReviewThanks for the PR. The implementation is generally solid. A few issues worth addressing before merge: Documentation inconsistency — webpack-cli v7 shown without Node caveat docs/optional-peer-dependencies.md shows webpack-cli ^7.0.0 in its Webpack+Babel and Webpack+SWC examples with no Node.js version caveat. This contradicts the README (which recommends ^6.0.0 and notes v7 requires Node >= 20.9.0) and the installer (which defaults to v6). Users on Node 20.0-20.8 following those docs will hit install failures with no guidance. The examples should either use ^6.0.0 or include the same Node caveat as the README. CI node version vs. declared engine floor dummy.yml pins node-version 20 but spec/dummy/package.json now declares node >=20.9.0. In practice GitHub Actions resolves 20 to the latest 20.x so CI passes today. But pinning to at least 20.9 would make the constraint explicit and avoid surprises if the runner image ever changes. Installer always selects v6 regardless of actual Node version The template.rb logic pattern-matches on the constraint string and always picks v6, even when the user is on Node >=20.9.0. This is intentionally conservative, but users on modern Node who want v7 must know to manually upgrade. The installer output or upgrade docs should note that users on Node >=20.9.0 can pin webpack-cli ^7.0.0 themselves. |
| "webpack": "^5.76.0", | ||
| "webpack-cli": "^5.0.0", | ||
| "webpack": "^5.101.0", | ||
| "webpack-cli": "^7.0.0", |
There was a problem hiding this comment.
This example uses ^7.0.0 directly, but webpack-cli v7 requires Node.js >= 20.9.0. Users on Node 20.0–20.8 who copy this snippet will get an install error with no indication of why.
The README uses ^6.0.0 here with a separate note about v7. These two docs should be consistent — either use ^6.0.0 in this example, or add a Node version caveat:
| "webpack-cli": "^7.0.0", | |
| "webpack-cli": "^6.0.0", |
(Or keep ^7.0.0 but add a note above the snippet: > **Note:** webpack-cli v7 requires Node.js >= 20.9.0. Use ^6.0.0 if you are on an older Node 20 release.)
| "webpack": "^5.76.0", | ||
| "webpack-cli": "^5.0.0", | ||
| "webpack": "^5.101.0", | ||
| "webpack-cli": "^7.0.0", |
There was a problem hiding this comment.
Same issue as the Webpack+Babel example above — ^7.0.0 is shown without the Node >= 20.9.0 caveat.
| "webpack-cli": "^7.0.0", | |
| "webpack-cli": "^6.0.0", |
| if package == "webpack-cli" && constraints.length > 1 | ||
| # Keep installer defaults compatible with Node.js >= 20.0.0. | ||
| # webpack-cli v7 requires Node >= 20.9.0, so default to the latest v6 range. | ||
| selected_version = constraints.find { |constraint| constraint.start_with?("^6.") } || selected_version |
There was a problem hiding this comment.
This always installs v6 regardless of the user's actual Node.js version. On Node >= 20.9.0 (or Node 21/22), webpack-cli v7 would work fine but users still get v6.
This is a safe, conservative default, but it can surprise users who read the peer dependencies docs and expect v7. Consider adding a say note after installation, e.g.:
say "Note: webpack-cli ^6.0.0 was installed for Node.js compatibility. If your Node version is >= 20.9.0, you can upgrade to webpack-cli ^7.0.0 manually."
Or alternatively, inspect the Node version at install time to decide:
node_major, node_minor = `node --version`.strip.delete_prefix("v").split(".").first(2).map(&:to_i)
selected_version = (node_major > 20 || (node_major == 20 && node_minor >= 9)) ? constraints.last : constraints.find { |c| c.start_with?("^6.") } || selected_version| essential_webpack = { | ||
| "webpack" => "^5.76.0", | ||
| "webpack-cli" => "^4.9.2 || ^5.0.0" | ||
| "webpack" => "^5.101.0", |
There was a problem hiding this comment.
This only checks that the package is present, not that it satisfies the new version floor (^5.101.0). This was existing behavior, but now that the minimum has been bumped, a user on webpack 5.76–5.100 would pass the doctor check and see confusing build errors later.
Consider checking the installed version against the constraint, similar to what other doctor checks do (if any), or at least document in a comment that this is a presence-only check.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 41944ac7d8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| "webpack": "5.101.3", | ||
| "webpack-assets-manifest": "^5.0.6", | ||
| "webpack-cli": "^6.0.0", | ||
| "webpack-cli": "^7.0.0", |
There was a problem hiding this comment.
Raise repo Node floor when upgrading webpack-cli to v7
Updating the repository dev dependency to webpack-cli@^7.0.0 raises the tooling requirement to Node >=20.9.0, but the project still declares engines.node as >=20. This creates a setup trap for contributors on Node 20.0–20.8: they satisfy the declared engine yet encounter engine incompatibility during dependency install (especially with the repo’s default Yarn workflow), which blocks local development and CI parity.
Useful? React with 👍 / 👎.
- docs/optional-peer-dependencies.md: use ^6.0.0 in examples (matching README) and add Node >= 20.9.0 caveat for v7 - .github/workflows/dummy.yml: pin node-version to 20.9 to match spec/dummy/package.json engine floor - lib/install/template.rb: print info message when defaulting to v6, telling users on Node >= 20.9.0 they can upgrade to v7 Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
|
All three items addressed in e899119:
|
|
Code Review - PR 1021 The core addition (expanding webpack-cli peer dep to include ^7.0.0) is clean, the deprecation-warning helper is well-structured, and the new Jest tests are a good addition. A few issues worth addressing:
The PR drops ^4.15.2 from the webpack-dev-server peer range (a breaking change), but check_webpack_peer_deps in doctor.rb never checks which version of webpack-dev-server is installed. A user who still has v4 after upgrading will get confusing runtime errors with no doctor guidance. Consider adding webpack-dev-server => ^5.2.2 to the essential_webpack hash, or at minimum a version-range check that warns when v4 is detected.
The fallback logic uses constraint.start_with?('^6.'). This is tightly coupled to the current constraint format - if the string ever has a different prefix style, the find silently falls through to selected_version (v7), which is the opposite of the intended safe default. Using the full exact string '^6.0.0' would be more precise, and a comment explaining the fallback behaviour would help future maintainers.
This PR bundles three breaking changes: minimum webpack bumped from ^5.76.0 to ^5.101.0, webpack-dev-server v4 dropped, and installer defaults changed. These are documented in CHANGELOG.md (good), but worth confirming whether the project semver policy requires a new major version, or whether they roll into the current minor. The PR title only mentions the webpack-cli v7 addition, which understates the impact.
Bumping engines.node from >=18.0.0 to >=20.9.0 prevents contributors on Node 20.0-20.8 from running dummy integration tests even though webpack-cli v6 (the new installer default) works fine on those versions. The installer v6 fallback exists precisely to support broad Node 20.x compatibility - this constraint works against that goal. Consider >=20.0.0 instead. |
| if package == "webpack-cli" && constraints.length > 1 | ||
| # Keep installer defaults compatible with Node.js >= 20.0.0. | ||
| # webpack-cli v7 requires Node >= 20.9.0, so default to the latest v6 range. | ||
| selected_version = constraints.find { |constraint| constraint.start_with?("^6.") } || selected_version |
There was a problem hiding this comment.
The start_with?("^6.") match is fragile — any variation in the constraint format (e.g. extra space, different prefix) causes the find to return nil and silently fall through to selected_version (v7), which is the opposite of the intended safe default.
Prefer an exact match on the known constraint string:
| selected_version = constraints.find { |constraint| constraint.start_with?("^6.") } || selected_version | |
| selected_version = constraints.find { |constraint| constraint == "^6.0.0" } || selected_version |
Also worth adding a comment explaining why v6 is preferred over the last constraint, so future maintainers don't remove this when adding v8 support.
| "webpack-cli" => "^4.9.2 || ^5.0.0" | ||
| "webpack" => "^5.101.0", | ||
| "webpack-cli" => "^4.9.2 || ^5.0.0 || ^6.0.0 || ^7.0.0" | ||
| } |
There was a problem hiding this comment.
This PR drops webpack-dev-server v4 support (a breaking change), but webpack-dev-server is not included in the essential_webpack check. A user who still has v4 installed after upgrading will see cryptic runtime errors rather than a clear doctor warning.
Consider adding it here:
| } | |
| "webpack-cli" => "^4.9.2 || ^5.0.0 || ^6.0.0 || ^7.0.0", | |
| "webpack-dev-server" => "^5.2.2" |
| { | ||
| "engines": { | ||
| "node": ">=18.0.0", | ||
| "node": ">=20.9.0", |
There was a problem hiding this comment.
Bumping to >=20.9.0 is correct for webpack-cli v7, but the installer defaults to webpack-cli v6 specifically to support all of Node 20.x. This constraint prevents contributors on Node 20.0–20.8 from running the dummy integration tests even with the v6 default path.
Consider >=20.0.0 to stay consistent with the installer's compatibility intent:
| "node": ">=20.9.0", | |
| "node": ">=20.0.0", |
Code Review: Allow webpack-cli v7 in peer dependenciesThe overall direction is good. The CHANGELOG correctly marks the WDS v4 drop and webpack minimum bump as breaking. A few things worth noting: 1. Hardcoded The 2. Test assertions in webpackDevServerConfig.test.js check keys that would never have been set (lines 26-27)
3. spec/dummy/package.json engines raised to >=20.9.0 The dummy app now requires Node >= 20.9.0 (up from >= 18.0.0) because it pins webpack-cli v7. The main docs recommend v6 by default (Node 20.0+), so there is now a split between what the docs say and what the dummy app requires. Users copying the dummy app as a starting point may be confused. 4. node-version: "20.x" in CI vs the new engine floor With spec/dummy/package.json requiring >=20.9.0, using "20.x" in the workflow resolves to the latest 20.x today, so it works. But using "20.9" or ">=20.9" would express the intent more precisely and guard against any runner that might resolve to an older 20.x patch. |
| if package == "webpack-cli" && constraints.length > 1 | ||
| # Keep installer defaults compatible with Node.js >= 20.0.0. | ||
| # webpack-cli v7 requires Node >= 20.9.0, so default to the latest v6 range. | ||
| selected_version = constraints.find { |constraint| constraint.start_with?("^6.") } || selected_version |
There was a problem hiding this comment.
This string match on "^6." is fragile. If the peer dep range later gains ^8.0.0, this check will still silently default to v6 rather than the intended "latest safe" version. The fallback to selected_version (which is constraints.last) means the intent is already "use last unless we explicitly override it to v6" — but that override logic won't age well.
Consider extracting a constant or adding a comment that this sentinel must be updated manually when the peer dep range changes:
| selected_version = constraints.find { |constraint| constraint.start_with?("^6.") } || selected_version | |
| # webpack-cli v7 requires Node >= 20.9.0; default to v6 for broader compat. | |
| # NOTE: Update this sentinel if the peer dep range gains a new major version | |
| # that should become the new safe default (e.g. change "^6." to "^7."). | |
| selected_version = constraints.find { |constraint| constraint.start_with?("^6.") } || selected_version |
| expect(config.onBeforeSetupMiddleware).toBeUndefined() | ||
| expect(config.onAfterSetupMiddleware).toBeUndefined() |
There was a problem hiding this comment.
These camelCase assertions pass trivially regardless of this PR. onBeforeSetupMiddleware / onAfterSetupMiddleware were already removed from webpackDevServerMappedKeys, so they would never appear in the output config under any circumstances.
The new behavior being tested is that the snake_case keys are deleted from devServerYamlConfig before the generic mapping loop runs (preventing them from potentially leaking through). Asserting the snake_case forms is more meaningful:
| expect(config.onBeforeSetupMiddleware).toBeUndefined() | |
| expect(config.onAfterSetupMiddleware).toBeUndefined() | |
| expect(config.on_before_setup_middleware).toBeUndefined() | |
| expect(config.on_after_setup_middleware).toBeUndefined() |
| { | ||
| "engines": { | ||
| "node": ">=18.0.0", | ||
| "node": ">=20.9.0", |
There was a problem hiding this comment.
This now requires Node >= 20.9.0 because webpack-cli v7 is pinned here. The main project docs recommend webpack-cli v6 as the default (Node 20.0+), so the dummy app now has a stricter floor than what new users are guided toward. Callers who copy this file as a template may be caught off-guard. Consider adding a comment explaining the reason, or switching the dummy app to webpack-cli v6 to match the recommended default.
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: "20" | ||
| node-version: "20.x" |
There was a problem hiding this comment.
With spec/dummy/package.json now requiring node >= 20.9.0, using "20.x" works today (resolves to 20.19+), but "20.9" or "20.9.x" would make the intent explicit and guard against a future runner resolving to an older 20.x patch.
| node-version: "20.x" | |
| node-version: "20.9" |
…pass-1 * origin/main: Allow webpack-cli v7 in peer dependencies (#1021) # Conflicts: # docs/peer-dependencies.md
Documents both user-visible changes from this PR under Unreleased: - Changed: shakapacker:install now defaults fresh Rspack installs to v2 via the widened lib/install/package.json range. - Fixed: @rspack/plugin-react-refresh peer range widened to accept v2, resolving the ERESOLVE conflict for users installing v2 of the plugin. Follows the format and level of detail used for analogous prior entries (PR #975 for the initial rspack v2 peer widening, PR #1021 for the webpack-cli installer default change).
* origin/main: (22 commits) docs: add Dependabot configuration guide (#1094) Sync address-review prompt with upstream PR #16 (#1098) Supersede #910: entry shape test with lint unblock (#919) fix: align rspack v2 peer deps and installer defaults (#1091) docs: update README and guides for Shakapacker v10 (#1092) Release 10.0.0 Update CHANGELOG.md for v10.0.0 (#1089) Release 10.0.0-rc.1 Update CHANGELOG.md for v10.0.0-rc.1 (#1087) Supersede #961 by using pack-config-diff (#973) Add final summary output to rake release (#1041) Add bin/setup to install development deps (#1039) Release 10.0.0-rc.0 Use npx release-it to avoid mise shim failures (#1040) Fix Nokogiri build failure on Ruby 3.4.6 (#1038) Update CHANGELOG.md for v10.0.0-rc.0 (#1037) Update rspack dev deps to 2.0.0-rc.0 (#1036) Fix stale and broken documentation across Shakapacker guides (#1023) Allow webpack-cli v7 in peer dependencies (#1021) refactor: simplify resolving js peer versions when installing (#1034) ... # Conflicts: # package.json

Summary
^7.0.0to thewebpack-clipeer dependency range inpackage.jsondocs/peer-dependencies.mdto matchFixes #1020
Test plan
package.jsonpeer dependency now includes^7.0.0🤖 Generated with Claude Code
Note
Medium Risk
Dependency constraint changes (including dropping webpack-dev-server v4 and raising minimum webpack) can break existing consumer setups and CI if lockfiles/Node versions aren’t updated. Code changes are small and covered by added tests, but affect install and dev-server configuration paths.
Overview
Updates Shakapacker’s Webpack toolchain compatibility: peer dependency ranges now include
webpack-cli^7, bump minimumwebpackto^5.101.0, and dropwebpack-dev-serverv4 support in favor of^5.2.2(documented as breaking).Adjusts installer and runtime behavior to match:
shakapacker:installnow defaultswebpack-cliinstalls to^6for Node 20.0–20.8 compatibility while still allowing v7, andwebpackDevServerConfigwarns and ignores removeddev_serverYAML hooks (on_before_setup_middleware/on_after_setup_middleware). Tests, dummy app configs/locks, and docs are updated accordingly, along with minor CI and ignore-file tweaks.Written by Cursor Bugbot for commit a76181e. This will update automatically on new commits. Configure here.
Summary by CodeRabbit
New Features
Documentation
Chores
Tests