Skip to content

Commit 952216d

Browse files
justin808ihabadhamclaude
authored
Bump Rspack dependencies to v2 (^2.0.0-0) (#3084)
## Summary - Updates generator and `bin/switch-bundler` Rspack dependencies from v1 to v2 - `@rspack/core@^2.0.0-0` and `@rspack/cli@^2.0.0-0` — the `-0` prerelease suffix ensures RC builds (currently `2.0.0-rc.1`) are included until stable 2.0.0 lands - `@rspack/plugin-react-refresh@^2.0.0` — already stable at 2.0.0 - `rspack-manifest-plugin@^5.0.0` — unchanged, already compatible with Rspack v2 Closes #3082 ## Test plan - [x] `js_dependency_manager_spec.rb` passes - [x] RuboCop passes on all changed files - [x] CI passes 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Changed** * Upgraded Rspack bundler support from version 1 to version 2. Updated dependency configurations in the installation generator and bundler switching utility to use Rspack v2 packages, enabling support for prerelease and release candidate builds. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: ihabadham <ihabadham4p@gmail.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 5c56db0 commit 952216d

5 files changed

Lines changed: 17 additions & 8 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ After a release, run `/update-changelog` in Claude Code to analyze commits, writ
3434
- **Doctor accepts TypeScript server bundle entrypoints**: `react_on_rails:doctor` now resolves common source entrypoint suffixes (`.js`, `.jsx`, `.ts`, `.tsx`, `.mjs`, `.cjs`) before warning that the server bundle is missing, preventing false positives when apps use `server-bundle.ts`. [PR 3111](https://github.com/shakacode/react_on_rails/pull/3111) by [justin808](https://github.com/justin808).
3535
- **Doctor no longer fails custom projects for a missing generated `bin/dev`**: `react_on_rails:doctor` now downgrades a missing official React on Rails `bin/dev` launcher from an error to a warning and adds explicit guidance when a custom `./dev` script is detected, so custom projects can pass diagnostics when their development setup is intentional. Fixes [Issue 3103](https://github.com/shakacode/react_on_rails/issues/3103). [PR 3117](https://github.com/shakacode/react_on_rails/pull/3117) by [justin808](https://github.com/justin808).
3636

37+
#### Changed
38+
39+
- **Rspack install scaffolding now targets Rspack v2**: `react_on_rails:install --rspack` and `bin/switch-bundler` now generate the Rspack v2 package line (`@rspack/core@^2.0.0-0`, `@rspack/cli@^2.0.0-0`, `@rspack/plugin-react-refresh@^2.0.0`) while keeping `rspack-manifest-plugin@^5.0.0`, which is already compatible. Closes [Issue 3082](https://github.com/shakacode/react_on_rails/issues/3082). [PR 3084](https://github.com/shakacode/react_on_rails/pull/3084) by [justin808](https://github.com/justin808).
40+
3741
### [16.6.0] - 2026-04-09
3842

3943
#### Removed

react_on_rails/lib/generators/react_on_rails/js_dependency_manager.rb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,16 +91,19 @@ module JsDependencyManager
9191
].freeze
9292

9393
# Rspack core dependencies (only installed when --rspack flag is used)
94+
# @rspack/core uses ^2.0.0-0 (with -0 prerelease suffix) to include RC/beta prereleases
95+
# of 2.0.0 until the stable 2.0.0 release lands.
9496
RSPACK_DEPENDENCIES = %w[
95-
@rspack/core@^1.0.0
97+
@rspack/core@^2.0.0-0
9698
rspack-manifest-plugin@^5.0.0
9799
].freeze
98100

99101
# Rspack development dependencies for hot reloading
100102
# react-refresh is pre-1.0, so left bare (see pinning note above).
103+
# @rspack/cli uses ^2.0.0-0 to match @rspack/core's prerelease range.
101104
RSPACK_DEV_DEPENDENCIES = %w[
102-
@rspack/cli@^1.0.0
103-
@rspack/plugin-react-refresh@^1.0.0
105+
@rspack/cli@^2.0.0-0
106+
@rspack/plugin-react-refresh@^2.0.0
104107
react-refresh
105108
].freeze
106109

react_on_rails/lib/generators/react_on_rails/templates/base/base/bin/switch-bundler

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ class BundlerSwitcher
1515
}.freeze
1616

1717
RSPACK_DEPS = {
18-
dependencies: %w[@rspack/core@^1.0.0 rspack-manifest-plugin@^5.0.0],
19-
dev_dependencies: %w[@rspack/cli@^1.0.0 @rspack/plugin-react-refresh@^1.0.0]
18+
dependencies: %w[@rspack/core@^2.0.0-0 rspack-manifest-plugin@^5.0.0],
19+
dev_dependencies: %w[@rspack/cli@^2.0.0-0 @rspack/plugin-react-refresh@^2.0.0]
2020
}.freeze
2121

2222
def initialize(target_bundler)

react_on_rails/spec/react_on_rails/generators/install_generator_spec.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,9 @@ class ActiveSupport::TestCase
675675
it "switch-bundler has version-pinned deps and strips versions before deletion" do
676676
assert_file "bin/switch-bundler" do |content|
677677
# Version pins are present in the constants
678-
expect(content).to include("@rspack/core@^1.0.0")
678+
expect(content).to include("@rspack/core@^2.0.0-0")
679+
expect(content).to include("@rspack/cli@^2.0.0-0")
680+
expect(content).to include("@rspack/plugin-react-refresh@^2.0.0")
679681
expect(content).to include("webpack@^5.0.0")
680682
# Version-stripping regex is used for package.json key deletion
681683
expect(content).to include('dep[%r{\A(@[^/]+/[^@]+|[^@]+)}]')

react_on_rails/spec/react_on_rails/generators/js_dependency_manager_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,14 +140,14 @@ def errors
140140

141141
it "defines RSPACK_DEPENDENCIES" do
142142
expect(ReactOnRails::Generators::JsDependencyManager::RSPACK_DEPENDENCIES).to eq(%w[
143-
@rspack/core@^1.0.0
143+
@rspack/core@^2.0.0-0
144144
rspack-manifest-plugin@^5.0.0
145145
])
146146
end
147147

148148
it "defines RSPACK_DEV_DEPENDENCIES" do
149149
expect(ReactOnRails::Generators::JsDependencyManager::RSPACK_DEV_DEPENDENCIES).to(
150-
eq(%w[@rspack/cli@^1.0.0 @rspack/plugin-react-refresh@^1.0.0 react-refresh])
150+
eq(%w[@rspack/cli@^2.0.0-0 @rspack/plugin-react-refresh@^2.0.0 react-refresh])
151151
)
152152
end
153153

0 commit comments

Comments
 (0)