Commit 0a15053
fix: align rspack v2 peer deps and installer defaults (#1091)
## Summary
Make Shakapacker's Rspack v2 support self-consistent by:
- widening `@rspack/plugin-react-refresh` peer support to `^1.0.0 ||
^2.0.0-0`
- widening `lib/install/package.json` so `shakapacker:install` selects
Rspack v2 for `@rspack/core` and `@rspack/cli`
- updating the Rspack docs/examples to match the new default install
path
## Why
PR #975 widened the root peer ranges for `@rspack/core` and
`@rspack/cli`, but `shakapacker:install` still read
`lib/install/package.json` and installed the v1 line:
- `@rspack/core: ^1.0.0`
- `@rspack/cli: ^1.0.0`
At the same time, `@rspack/plugin-react-refresh` stayed pinned to
`^1.0.0` in `package.json`.
That left Rspack v2 support in an inconsistent state:
1. fresh installs still started on Rspack v1
2. downstream projects that intentionally upgraded to Rspack v2 could
end up in install / reinstall conflicts because Shakapacker still
advertised plugin v1-only peer support
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-0`
- `lib/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-0`
- docs
- remove the stale plugin-v1 note
- update peer-deps docs and dependency examples to match the new
supported/default path
Because `lib/install/template.rb` already selects `constraints.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:install` with
`SHAKAPACKER_ASSETS_BUNDLER=rspack` wrote:
- `@rspack/core: ^2.0.0-0`
- `@rspack/cli: ^2.0.0-0`
- `npm install --save-dev @rspack/cli@^2.0.0-0
@rspack/plugin-react-refresh@^2.0.0 react-refresh` succeeded
- clean later `npm install` succeeded
- `bundle exec rails shakapacker:compile` succeeded with Rspack
`2.0.0-rc.1`
### 2) 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-warnings` succeeded
- resulting app had:
- `@rspack/core: ^2.0.0-0`
- `@rspack/cli: ^2.0.0-0`
- `@rspack/plugin-react-refresh: 2.0.0`
- clean later `npm install` succeeded
- `bundle exec rails shakapacker:compile` succeeded
So this removes the need for downstream generator-time workarounds and
gives React on Rails a clean path to ship Rspack v2.
## Pull Request checklist
- [x] Update documentation
- [x] Update CHANGELOG file
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Documentation**
* Updated docs and examples to reference the Rspack v2 prerelease ranges
and Shakapacker v10, and removed an outdated note about plugin
versioning.
* **Chores**
* Broadened dependency/peer ranges to support both the stable v1 line
and the v2 prerelease line and adjusted install defaults to use the
latest supported Rspack range.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 860a5ef commit 0a15053
7 files changed
Lines changed: 19 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
12 | 20 | | |
13 | 21 | | |
14 | 22 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
281 | 281 | | |
282 | 282 | | |
283 | 283 | | |
284 | | - | |
285 | | - | |
| 284 | + | |
| 285 | + | |
286 | 286 | | |
287 | 287 | | |
288 | 288 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
88 | | - | |
89 | | - | |
| 88 | + | |
| 89 | + | |
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
| 38 | + | |
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
11 | 13 | | |
12 | 14 | | |
13 | 15 | | |
14 | 16 | | |
15 | | - | |
16 | | - | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
| 3 | + | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
105 | | - | |
| 105 | + | |
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
| |||
0 commit comments