fix: align rspack v2 peer deps and installer defaults#1091
Conversation
WalkthroughRspack-related peer dependency ranges were expanded to include the v2 prerelease line ( Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
ReviewThe change itself is correct and well-scoped: widening the peer dep range for `@rspack/plugin-react-refresh` from `^1.0.0` to `^1.0.0 || ^2.0.0-0` is the right fix now that v2.0.0 shipped, and the stale note removal from `docs/rspack.md` is clean. One doc file was missed`docs/peer-dependencies.md` line 38 still shows the old range and was not updated in this PR: ```text // should be That file is meant to be a human-readable mirror of `package.json`'s peer dep ranges, so it should stay in sync. Minor: CHANGELOGThe PR checklist defers the changelog entry. Since this resolves a real user-facing peer dep warning, it warrants at minimum a one-liner under the next version's Fixed or Changed section. Happy to see it merged first and the changelog entry added in a follow-on, but worth tracking. Everything else looks good
|
Greptile SummaryThis PR widens the Confidence Score: 5/5Safe to merge — one-line peer dep range expansion with no runtime code changes. All findings are P2 (missing CHANGELOG entry, explicitly deferred by the author). The peer dep range format is correct, matches existing patterns, and the optional flag in peerDependenciesMeta means v1 users are unaffected. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[User installs rspack v2 + shakapacker] --> B{Peer dep range check}
B -->|Before PR - range was v1 only| C["npm resolves v2 plugin\nbut peer range says ^1.0.0"]
C --> D["⚠️ Peer dep warning on every install"]
B -->|After PR - range accepts v1 or v2| E["npm resolves v2 plugin\nwithin declared range"]
E --> F["✅ No peer dep warning"]
Reviews (1): Last reviewed commit: "chore: widen @rspack/plugin-react-refres..." | Re-trigger Greptile |
|
Expanded this PR beyond the original peer-range-only change. What was added in the latest commit:
Why this matters:
I verified this end-to-end in real fresh Rails apps using this branch as both:
Verified behavior:
I also verified the full downstream |
ReviewThe core change — widening A few things worth addressing: CHANGELOG is missingWidening a peer dep range to include a new major version is a user-visible change. The checklist marks this as "deferred", but per the project guidelines this should have an entry under
|
The peer range for @rspack/plugin-react-refresh was left at ^1.0.0 when #975 added rspack v2 support, because @rspack/[email protected] did not exist yet on npm at that time. The same PR documented this in docs/rspack.md: > React refresh plugin note: @rspack/plugin-react-refresh currently > remains on the v1 line in Shakapacker peer deps. @rspack/[email protected] shipped on 2026-04-08. Users installing rspack v2 now pull plugin-react-refresh v2 (it has a peer dep on @rspack/core@^2.0.0-0, making it the canonical choice for rspack v2), but the Shakapacker peer range still restricts to v1 and emits a warning on install. This widens the range to `^1.0.0 || ^2.0.0-0` to match the format used for @rspack/cli and @rspack/core, and removes the now-stale docs note. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
cbaf0f6 to
c40a100
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
docs/rspack.md (1)
11-12: Clarify dual-range metadata vs installer default selectionCurrent wording can be misread as
lib/install/package.jsoncontaining only a v2 constraint. Consider explicitly stating that the file keeps both ranges and installer logic selects the latest one by default.Proposed doc tweak
-Fresh installs default to the latest supported Rspack range from `lib/install/package.json`, which is currently the Rspack v2 prerelease line (`^2.0.0-0`). +Fresh installs read Rspack constraints from `lib/install/package.json` (which currently allows both v1 and v2), and installer selection defaults to the latest supported range—currently the Rspack v2 prerelease line (`^2.0.0-0`).🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/rspack.md` around lines 11 - 12, The sentence about fresh installs should explicitly state that lib/install/package.json contains both supported Rspack version ranges (v1 and v2) and that the installer logic chooses the latest supported range by default; update the line in docs/rspack.md to mention the dual-range metadata (both ranges are stored) and that the installer selects the latest supported constraint (currently the v2 prerelease `^2.0.0-0`) as the default for fresh installs so readers don’t assume the file only lists v2.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@docs/rspack.md`:
- Around line 11-12: The sentence about fresh installs should explicitly state
that lib/install/package.json contains both supported Rspack version ranges (v1
and v2) and that the installer logic chooses the latest supported range by
default; update the line in docs/rspack.md to mention the dual-range metadata
(both ranges are stored) and that the installer selects the latest supported
constraint (currently the v2 prerelease `^2.0.0-0`) as the default for fresh
installs so readers don’t assume the file only lists v2.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: f93cbb73-9a28-4fb3-acc9-c13e042f405f
📒 Files selected for processing (6)
README.mddocs/optional-peer-dependencies.mddocs/peer-dependencies.mddocs/rspack.mdlib/install/package.jsonpackage.json
✅ Files skipped from review due to trivial changes (4)
- README.md
- lib/install/package.json
- package.json
- docs/peer-dependencies.md
🚧 Files skipped from review as they are similar to previous changes (1)
- docs/optional-peer-dependencies.md
Code ReviewSummary: This PR correctly fixes an inconsistency where PR #975 widened the root peer ranges to support Rspack v2, but the installer template Correctness ✅The core fix is sound:
Issues1. CHANGELOG not updated (acknowledged in PR checklist, but this is a user-visible installer behaviour change — it warrants an entry under 2. 3. Minor: doc wording will date quickly — Minor notes
VerdictThe fix is correct and minimal. The two things to address before merging: missing CHANGELOG entry, and a decision on whether to add |
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).
Code Review: PR #1091 — Align rspack v2 peer deps and installer defaultsSummaryThe PR correctly fixes a real inconsistency: PR #975 widened the root peer ranges for IssuesMedium — CI does not test The peer range for Low — devDependency pin is behind the verified version
Low — no automated test for installer version selection The PR checklist acknowledges this. For future reference, Low — README example exposes the prerelease range
What looks good
|
Address-review summaryScan scope: full PR history (no prior summary comment existed). Mattered
Optional
Skipped
Next default scan starts after this comment. Say |
|
Thanks for the thorough triage. The dispositions all look reasonable:
Nothing left to block merge from my side. LGTM. Tip: You can customize Greptile's behavior for this repo with |
* 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
* origin/main: 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) # Conflicts: # CHANGELOG.md # Rakefile
Summary
Make Shakapacker's Rspack v2 support self-consistent by:
@rspack/plugin-react-refreshpeer support to^1.0.0 || ^2.0.0-0lib/install/package.jsonsoshakapacker:installselects Rspack v2 for@rspack/coreand@rspack/cliWhy
PR #975 widened the root peer ranges for
@rspack/coreand@rspack/cli, butshakapacker:installstill readlib/install/package.jsonand installed the v1 line:@rspack/core: ^1.0.0@rspack/cli: ^1.0.0At the same time,
@rspack/plugin-react-refreshstayed pinned to^1.0.0inpackage.json.That left Rspack v2 support in an inconsistent state:
This surfaced directly in the downstream React on Rails Rspack v2 work: shakacode/react_on_rails#3084.
What this changes
package.json@rspack/plugin-react-refresh:^1.0.0→^1.0.0 || ^2.0.0-0lib/install/package.json@rspack/core:^1.0.0→^1.0.0 || ^2.0.0-0@rspack/cli:^1.0.0→^1.0.0 || ^2.0.0-0Because
lib/install/template.rbalready selectsconstraints.last, widening those installer ranges makes fresh Rspack installs choose the v2 prerelease line automatically.Verification
I verified this with real fresh Rails apps, not just isolated package-manager commands.
1) Shakapacker alone
Using a local path gem plus a locally packed npm tarball from this branch:
bundle exec rails shakapacker:installwithSHAKAPACKER_ASSETS_BUNDLER=rspackwrote:@rspack/core: ^2.0.0-0@rspack/cli: ^2.0.0-0npm install --save-dev @rspack/cli@^2.0.0-0 @rspack/plugin-react-refresh@^2.0.0 react-refreshsucceedednpm installsucceededbundle exec rails shakapacker:compilesucceeded with Rspack2.0.0-rc.12) Full React on Rails install flow
Using this Shakapacker branch plus the downstream React on Rails PR branch locally:
bundle exec rails generate react_on_rails:install --rspack --ignore-warningssucceeded@rspack/core: ^2.0.0-0@rspack/cli: ^2.0.0-0@rspack/plugin-react-refresh: 2.0.0npm installsucceededbundle exec rails shakapacker:compilesucceededSo this removes the need for downstream generator-time workarounds and gives React on Rails a clean path to ship Rspack v2.
Pull Request checklist
Summary by CodeRabbit
Documentation
Chores