feat(generator): scaffold native RSCRspackPlugin for rspack RSC (#3488)#3590
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:
WalkthroughGenerators, templates, migration logic, dependency management, specs, and docs now select and verify the RSC manifest plugin class/import based on bundler (rspack vs webpack), adding normalization, dedup, and rspack-specific dependency guidance. ChangesRSC Plugin Abstraction for Rspack and Webpack
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related issues
Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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 |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is ON. A cloud agent has been kicked off to fix the reported issue.
Reviewed by Cursor Bugbot for commit 5280682. Configure here.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5280682242
ℹ️ 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".
Greptile SummarySwitches the RSC generator from
Confidence Score: 4/5The rspack-specific changes are well-scoped and the idempotency fix is correct, but every webpack RSC install now pulls an RC package that stable 19.0.4 could serve instead. The core generator logic (helper methods, template parameterisation, broadened regex) is clean and the test coverage is thorough. The single concrete concern is that RSC_PACKAGE_VERSION_PIN is a shared constant used by both webpack and rspack RSC installs. Webpack projects have no dependency on the RspackPlugin export that necessitated the bump, so they are unnecessarily locked to a pre-release on every fresh --rsc install until stable 19.0.5 ships. react_on_rails/lib/generators/react_on_rails/js_dependency_manager.rb — the shared RSC_PACKAGE_VERSION_PIN constant and rsc_packages_with_version method. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[rails generate react_on_rails:install --rsc] --> B{using_rspack?}
B -- yes --> C[rsc_plugin_class_name = RSCRspackPlugin]
B -- no --> D[rsc_plugin_class_name = RSCWebpackPlugin]
C --> E[Templates scaffold RSCRspackPlugin in config/rspack/]
D --> F[Templates scaffold RSCWebpackPlugin in config/webpack/]
E --> G[rsc_setup migration runs]
F --> G
G --> H{RSC_PLUGIN_INVOCATION_REGEX matches existing plugin?}
H -- yes --> I[Skip re-injection - Idempotent re-run]
H -- no --> J[Inject rsc_plugin_class_name with import and instantiation]
G --> K[install react-on-rails-rsc at RSC_PACKAGE_VERSION_PIN]
K --> L[19.0.5-rc.5 installed for ALL bundlers]
Reviews (1): Last reviewed commit: "feat(generator): scaffold native RSCRspa..." | Re-trigger Greptile |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
react_on_rails/lib/generators/react_on_rails/rsc_setup.rb (1)
386-389:⚠️ Potential issue | 🟠 Major | ⚡ Quick winNormalize legacy plugin invocations before taking the existing-config path.
Now that
rsc_plugin_invocation_in_js_code?matches bothRSCWebpackPluginandRSCRspackPlugin, older rspack projects that still have the webpack plugin will hit this early return and only get theclientReferencesrewrite. The code never swapsRSCWebpackPlugin/react-on-rails-rsc/WebpackPluginto the native rspack pair, so standalone upgrades keep the compatibility-layer plugin that this PR is meant to replace.Please rewrite mismatched existing plugin imports/constructors to
rsc_plugin_class_name/rsc_plugin_import_pathbefore returning here, or only treat the file as “already configured” when it already uses the active bundler’s plugin.Also applies to: 436-438
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@react_on_rails/lib/generators/react_on_rails/rsc_setup.rb` around lines 386 - 389, The early-return path in the block that checks rsc_plugin_invocation_in_js_code? causes legacy webpack plugin names to persist; before calling update_existing_rsc_webpack_config (and returning) detect and normalize any legacy import/constructor identifiers to the active names: use rsc_plugin_class_name and rsc_plugin_import_path to replace legacy import specifiers and constructor calls in content (e.g., swap RSCWebpackPlugin / react-on-rails-rsc/WebpackPlugin to the current rsc_plugin_class_name and rsc_plugin_import_path), then call update_existing_rsc_webpack_config with the normalized content; alternatively, only take the existing-config path when the file already references the active bundler plugin (i.e., ensure rsc_plugin_invocation_in_js_code? reflects the active plugin before returning).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/pro/react-server-components/rspack-compatibility.md`:
- Line 15: Update the minimum version note to reflect the pinned release
candidate: change the text that currently reads "Exported from
`react-on-rails-rsc` 19.0.5 and later" to "Exported from `react-on-rails-rsc`
19.0.5-rc.5+ (switch to 19.0.5 stable once published)" so it matches the pinned
RSC_PACKAGE_VERSION_PIN = "19.0.5-rc.5"; keep the existing mention of
RspackPlugin / RSCRspackPlugin and the note about switching to the stable
release when available.
---
Outside diff comments:
In `@react_on_rails/lib/generators/react_on_rails/rsc_setup.rb`:
- Around line 386-389: The early-return path in the block that checks
rsc_plugin_invocation_in_js_code? causes legacy webpack plugin names to persist;
before calling update_existing_rsc_webpack_config (and returning) detect and
normalize any legacy import/constructor identifiers to the active names: use
rsc_plugin_class_name and rsc_plugin_import_path to replace legacy import
specifiers and constructor calls in content (e.g., swap RSCWebpackPlugin /
react-on-rails-rsc/WebpackPlugin to the current rsc_plugin_class_name and
rsc_plugin_import_path), then call update_existing_rsc_webpack_config with the
normalized content; alternatively, only take the existing-config path when the
file already references the active bundler plugin (i.e., ensure
rsc_plugin_invocation_in_js_code? reflects the active plugin before returning).
🪄 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: c7b2214a-71e4-4348-a8f3-496eed4f48de
📒 Files selected for processing (11)
docs/pro/react-server-components/rspack-compatibility.mdreact_on_rails/lib/generators/react_on_rails/generator_helper.rbreact_on_rails/lib/generators/react_on_rails/js_dependency_manager.rbreact_on_rails/lib/generators/react_on_rails/rsc_setup.rbreact_on_rails/lib/generators/react_on_rails/rsc_setup/client_references.rbreact_on_rails/lib/generators/react_on_rails/templates/base/base/config/webpack/clientWebpackConfig.js.ttreact_on_rails/lib/generators/react_on_rails/templates/base/base/config/webpack/serverWebpackConfig.js.ttreact_on_rails/spec/react_on_rails/generators/generator_helper_spec.rbreact_on_rails/spec/react_on_rails/generators/install_generator_spec.rbreact_on_rails/spec/react_on_rails/generators/js_dependency_manager_spec.rbreact_on_rails/spec/react_on_rails/generators/rsc_generator_spec.rb
Code ReviewOverviewThis PR correctly pivots rspack RSC projects from the webpack-compat-layer Three issues worth addressing: 1. Upgrade path gap: existing rspack projects with
|
…arden specs Address review findings on PR #3590 (native RSCRspackPlugin scaffolding). The PR added `<%= rsc_plugin_class_name %>` / `<%= rsc_plugin_import_path %>` to the managed serverWebpackConfig.js.tt and clientWebpackConfig.js.tt templates. Those managed templates are re-rendered during stale-config cleanup (`rendered_template_for_cleanup`) against the restricted `TemplateRenderContext` binding, which did not expose those helpers. For any RSC project the cleanup render raised NameError, printed a "could not render template ... treating as non-removable" warning, and wrongly preserved the managed config files. Delegate both helpers in `TemplateRenderContext` (mirroring use_pro?/use_rsc?) to fix this, and add a regression spec asserting the RSC managed templates render (not the TEMPLATE_RENDER_FAILED sentinel) for both webpack and rspack projects. Also: - Make the rscWebpackConfig.js.tt skip comment bundler-neutral so rspack-generated configs no longer reference RSCWebpackPlugin. - Update two now-stale rsc_setup.rb docstrings that still described the RSC plugin detection/injection as webpack-only after the regex was broadened to match both plugin names. - Add an rspack dedup/idempotency spec mirroring the existing webpack contexts, exercising the rspack branch of RSC_PLUGIN_INVOCATION_REGEX (verified to fail if the regex regresses to webpack-only). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Code ReviewOverviewClean, well-scoped PR. The design is correct: introduce two helper methods as the single source of truth for the bundler-keyed plugin name/path, thread them through templates, migration code, and verification checks, and update the idempotency regex to match both names. The test additions are thorough and the dedup regression test for the existing-RSCRspackPlugin case is exactly the right edge case to cover. Medium issuesRC pin is installed into every new RSC project (webpack and rspack alike)
Minor issuesMethod names still say "webpack" but now generate bundler-dependent code Verification checks use Positives
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a8a9f9f6ee
ℹ️ 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".
Code Review: feat(generator): scaffold native RSCRspackPlugin for rspack RSC (#3488)OverviewThis PR is a clean, well-scoped change that switches rspack RSC projects from scaffolding Architecture / CorrectnessNormalization flow is correctly ordered. Idempotency guard is correct. Broadening Normalization bails consistently when ESM is used. When Issues FoundThree inline comments have been posted:
RC Version PinShipping Test CoverageCoverage is thorough: helper contract, fresh-install scaffolding (webpack and rspack), normalization of legacy webpack configs on rspack projects, dedup/idempotency, the cleanup re-render regression, and the dependency pin. No gaps noticed. SummaryAll three findings are minor (two style, one doc). The core logic is correct and well-tested. The PR is ready to merge once the inline nits are addressed (or explicitly waived). 🤖 Generated with Claude Code |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@react_on_rails/lib/generators/react_on_rails/rsc_setup/client_references.rb`:
- Around line 160-176: normalize_rsc_plugin_import_for_active_bundler can remove
an earlier inactive import while an active import appears later, causing a TDZ;
fix by computing the actual position of any existing active import (search
content with rsc_plugin_commonjs_import_regex(rsc_plugin_import_path) to get its
match.begin(0)) and only remove the inactive binding when that active import
occurs before the current inactive statement (i.e., active_pos <
Regexp.last_match.begin(0)). If the active import exists but is after the
current inactive match, instead rewrite the current (earlier) inactive statement
in-place to the active class/path and mark that position as the active import so
the later duplicate can be removed; keep updates localized to
normalize_rsc_plugin_import_for_active_bundler and coordinate with
normalize_rsc_plugin_invocations_for_active_bundler via the unchanged return
value ([normalized_content, active_import_seen]).
🪄 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: 8f196c73-13e8-443e-9e91-8fa5a5628d26
📒 Files selected for processing (6)
docs/pro/react-server-components/rspack-compatibility.mdreact_on_rails/lib/generators/react_on_rails/js_dependency_manager.rbreact_on_rails/lib/generators/react_on_rails/rsc_setup.rbreact_on_rails/lib/generators/react_on_rails/rsc_setup/client_references.rbreact_on_rails/spec/react_on_rails/generators/js_dependency_manager_spec.rbreact_on_rails/spec/react_on_rails/generators/rsc_generator_spec.rb
✅ Files skipped from review due to trivial changes (1)
- docs/pro/react-server-components/rspack-compatibility.md
🚧 Files skipped from review as they are similar to previous changes (2)
- react_on_rails/spec/react_on_rails/generators/js_dependency_manager_spec.rb
- react_on_rails/lib/generators/react_on_rails/rsc_setup.rb
Code Review: feat(generator) scaffold native RSCRspackPlugin for rspack RSC (#3488)OverviewThis PR correctly addresses the core problem: Rspack's webpack-compatibility layer produced valid-looking manifests that still broke ~7/11 RSC routes at runtime, while the native Issues1.
|
c6ae519 to
72d8b47
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 72d8b47afc
ℹ️ 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".
Code ReviewOverviewThis PR introduces a clean, well-structured swap from Strengths
IssuesSee inline comments for specific line references. Summary:
Overall this is well-reasoned, well-tested, and safe. Items 1 and 2 are the most actionable before merge. |
Code ReviewOverall: Solid, well-structured PR. The core design (centralize bundler choice through Issues1. Misleading comment —
|
Pro Node Renderer Benchmark Summary
🔴 significant regression · 🟢 significant improvement (vs baseline; tracked measures only) |
Core Benchmark Summary
🔴 significant regression · 🟢 significant improvement (vs baseline; tracked measures only) |
Pro (shard 2/2) Benchmark Summary
🔴 significant regression · 🟢 significant improvement (vs baseline; tracked measures only) |
Pro (shard 1/2) Benchmark Summary
🔴 significant regression · 🟢 significant improvement (vs baseline; tracked measures only) |
|
CI is green and the remaining review comments are polish/follow-up coverage items. I tracked them in #3646 so this can merge without restarting CI for nits. |
## Summary - generate an RSC-only server component registration entry from the pack generator - run an RSC reference discovery build from the precompile hook - have Pro client/server manifest configs consume the discovered refs JSON instead of broad filesystem scanning - update the Pro dummy build scripts to run the precompile hook before bundling - consume released `react-on-rails-rsc@19.0.5-rc.6` from npm - remove the old fork/patch path; rc.6 already includes the CSS manifest metadata fix needed here - upgrade existing broad `rscClientReferences` helpers to the manifest-backed helper during migration - keep discovery builds isolated from stale manifests and bundle-only env leakage Supports #3553. RSC package dependency: stay on `react-on-rails-rsc@19.0.5-rc.6`. I found no current gap that requires an rc.7. This PR should land after #3590 and preferably after #3616 so the generator and optional peer-range story are already in `main`. ## Architecture decisions - The generated helper intentionally uses the discovery manifest as the source of truth, then falls back to broad scanning only when the app has not generated a manifest yet or the installed RSC setup does not expose discovery support. - Existing broad object-literal `rscClientReferences` helpers are not treated as fully migrated. The generator upgrades them to the manifest-backed helper so upgraded apps get exact RSC graph references instead of silently keeping broad scanning. - The generated `fileContainsAll` checks read each inspected file once per check. This avoids repeated disk reads without memoizing across long-running webpack config evaluation, where setup files may change while a developer is iterating. - `build:dev:watch` deletes stale development webpack output and `ssr-generated` before running the precompile hook. It deliberately does not delete production output. - The shared and standalone precompile-hook paths now preserve failure backtrace context consistently. ## Verification Review-fix commit `9d414eabe530902c8b5073a92b69f61dc4f40501`: - `pnpm install --frozen-lockfile` - `bundle exec rubocop react_on_rails/lib/generators/react_on_rails/rsc_setup/client_references.rb react_on_rails/spec/react_on_rails/generators/rsc_generator_spec.rb react_on_rails/spec/react_on_rails/shakapacker_precompile_hook_shared_spec.rb react_on_rails/spec/support/shakapacker_precompile_hook_shared.rb` - `pnpm exec prettier --check react_on_rails_pro/spec/dummy/tests/rsc-manifest-client-references.test.js react_on_rails_pro/spec/dummy/tests/package-scripts.test.js react_on_rails_pro/spec/dummy/config/webpack/rscManifestClientReferences.js react_on_rails_pro/spec/dummy/package.json` - `bundle exec rspec react_on_rails/spec/react_on_rails/generators/rsc_generator_spec.rb` - `bundle exec rspec react_on_rails/spec/react_on_rails/shakapacker_precompile_hook_shared_spec.rb` - `pnpm --dir react_on_rails_pro/spec/dummy run test:js -- --runInBand tests/rsc-manifest-client-references.test.js tests/package-scripts.test.js` - `git diff --check` Earlier implementation verification retained from the original PR: - `cd react_on_rails/spec/dummy && bundle exec rspec spec/packs_generator_spec.rb` - `bundle exec rspec spec/requests/rsc_use_client_css_manifest_spec.rb` from `react_on_rails_pro/spec/dummy` - `NODE_CONDITIONS=react-server pnpm --dir packages/react-on-rails-pro exec jest tests/manifestLoaderServerRSC.rsc.test.ts --runInBand` - `pnpm --dir packages/react-on-rails-pro exec jest tests/manifestLoader.test.ts tests/resolveCssHrefs.test.ts --runInBand` - `pnpm run lint` - `pnpm start format.listDifferent` - `bundle exec rubocop` from `react_on_rails/` - `bundle exec rubocop --ignore-parent-exclusion` from `react_on_rails_pro/` - `bundle exec rubocop benchmarks` - `pnpm list react-on-rails-rsc --depth 0 -r` - `pnpm run build:dev` from `react_on_rails_pro/spec/dummy` - `pnpm run build:test` from `react_on_rails_pro/spec/dummy` - `pnpm run build:client` from `react_on_rails_pro/spec/dummy` - `pnpm run build:server` from `react_on_rails_pro/spec/dummy` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Integrates RSC client-reference discovery into the precompile/build flow to emit a client-reference manifest for bundling. * **Bug Fixes** * Resolves RSC CSS behavior behind "use client" boundaries by consuming the upstream prerelease. * **Chores** * Bumped RSC package to 19.0.5-rc.6 and removed the local patch override. * Expanded tests and CI to cover RSC discovery, manifest handling, and precompile hook behavior. <!-- end of auto-generated comment: release notes by coderabbit.ai --> ## Follow-up - #3642 tracks non-blocking review nits around PacksGenerator scan reuse, shared-hook traversal hardening, CSS prefix comments, discovery support memoization/documentation, and post-stable prerelease cleanup. <!-- codex-review-followups-start --> ### Review follow-ups Non-blocking review nits are tracked in #3642, including unresolved threads `PRRT_kwDOAnNnU86HSorq`, `PRRT_kwDOAnNnU86HSpqC`, and `PRRT_kwDOAnNnU86HSp95`. The two version-specific discovery-plugin error-message threads were addressed in the latest push and may remain visible only as outdated unresolved threads until reviewer cleanup. <!-- codex-review-followups-end --> --------- Co-authored-by: Justin Gordon <justin@shakacode.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Summary
Part of #3488 (Rspack RSC to production-ready). Switches the RSC generator to scaffold the native
RSCRspackPlugin(react-on-rails-rsc/RspackPlugin) for rspack projects instead ofRSCWebpackPlugin. Webpack projects are unchanged.This is the verified-correct manifest path for Rspack. A controlled A/B on the marketplace demo showed the webpack plugin running under Rspack's compatibility layer producing valid-looking manifests that still failed ~7/11 RSC routes at runtime, while the native
RSCRspackPlugin(standard rspack public APIs, identical manifest schema) rendered and hydrated every route. The two plugins share the same{ isServer, clientReferences }API, so this is a drop-in swap.Changes
GeneratorHelper):rsc_plugin_class_name/rsc_plugin_import_path, keyed onusing_rspack?, as the single source of truth for both generator paths.base/base/config/webpack/{server,client}WebpackConfig.js.tt): branch the plugin import + class on those helpers.rsc_setup.rb,rsc_setup/client_references.rb): parameterize the injected class name + import path by bundler; broaden the plugin-detection regex to match bothRSCWebpackPluginandRSCRspackPluginso re-run idempotency stays correct. A fresh--rsc --rspackinstall runs the migration on top of the template, so without this the migration would inject a second, webpack plugin.JsDependencyManager::RSC_PACKAGE_VERSION_PIN):19.0.4->19.0.5-rc.6, the release exporting./RspackPlugin. Backward-compatible for webpack (still exports./WebpackPlugin). Bumps to stable19.0.5when published (Rspack RSC: path to production-ready — pivot to native RSCRspackPlugin #3488).rspack-compatibility.md): reflect the native-plugin pivot; "experimental" label kept because the stable package and demo route-hydration CI gate are still pending in Rspack RSC: path to production-ready — pivot to native RSCRspackPlugin #3488.Architecture decisions and validation
react-on-rails-rsc@19.0.5-rc.6; no RC7 gap was found. All RSC installs share the rc.6 pin so webpack and rspack generator paths are tested against the same package.react-on-rails-rscafter a pinned install failure. Manual recovery instructions keep the rc.6 pin because older or unversioned packages may not exportRspackPlugin.clientReferencesrewrite safety gate, while unsupported ESM or multi-line plugin import shapes warn/comment rather than attempting a broader JavaScript rewrite.Validation after review fixes:
bundle exec rubocop react_on_rails/lib/generators/react_on_rails/js_dependency_manager.rb react_on_rails/lib/generators/react_on_rails/generator_helper.rb react_on_rails/lib/generators/react_on_rails/rsc_setup/client_references.rb react_on_rails/spec/react_on_rails/generators/generator_helper_spec.rb react_on_rails/spec/react_on_rails/generators/js_dependency_manager_spec.rb react_on_rails/spec/react_on_rails/generators/rsc_generator_spec.rbbundle exec rspec react_on_rails/spec/react_on_rails/generators/generator_helper_spec.rb react_on_rails/spec/react_on_rails/generators/js_dependency_manager_spec.rbbundle exec rspec react_on_rails/spec/react_on_rails/generators/rsc_generator_spec.rb:2159 react_on_rails/spec/react_on_rails/generators/rsc_generator_spec.rb:2416bundle exec rspec react_on_rails/spec/react_on_rails/generators/rsc_generator_spec.rb(198 examples, 0 failures)git diff --checkTests
install_generator_spec(--rsc --rspack): asserts nativeRSCRspackPluginand that no webpack plugin leaks in.rsc_generator_spec(standalone upgrade on an rspack project): same.--rsccontexts unchanged (regression guard).generator_helper_spec: contract test for the new helpers.js_dependency_manager_spec: updated pin assertions.Follow-up (out of scope - flagged from #3488 work)
While grounding this against the proven demo, I found a pre-existing, bundler-agnostic divergence in the RSC bundle loader strategy (NOT the plugin this PR swaps):
rscWebpackConfig.js.ttinjectsreact-on-rails-rsc/WebpackLoaderby wrapping the existing swc/babel rule, so it runs before transpilation (on raw TSX).enforce: 'post'rule, so the loader runs after swc compiles TSX to JS, giving acorn clean JavaScript to parse.WebpackLoaderparses via React'sreact-server-dom-webpack-node-loader(acorn), which needs already-transpiled JS, so the demo'senforce: 'post'may be the correct strategy and the generator's wrap-before-transpile may be fragile for TSX under both bundlers. This can't be verified from this repo (it needs the demo route-hydration gate), is identical for webpack and rspack, and is orthogonal to the plugin swap. Recommend tracking it on #3488 rather than expanding this PR.Note
Medium Risk
Changes affect RSC bundler config generation and dependency pinning for all
--rscinstalls; mistakes could break rspack RSC builds or leave wrong manifest plugins, though scope is generator/docs/tests rather than runtime rendering.Overview
Rspack RSC installs now scaffold
RSCRspackPluginfromreact-on-rails-rsc/RspackPlugininstead of the webpack-compatRSCWebpackPlugin, while webpack RSC projects keep the webpack plugin. Generator helpers (rsc_plugin_class_name,rsc_plugin_import_path, and inactive counterparts) centralize that choice fromusing_rspack?for fresh templates, standalone RSC upgrades, cleanup re-renders, and verification messages.Re-running RSC setup on rspack migrates legacy
RSCWebpackPluginimports andnewcalls to the native plugin when safe, dedupes duplicate imports, and flags the wrong plugin during verification. Plugin detection regexes and warnings cover both class names.react-on-rails-rscis pinned to19.0.5-rc.6for all--rscinstalls; if the pinned install fails on rspack, the generator does not fall back to unversionedlatest(which lacksRspackPlugin). Docs and changelog describe the native rspack manifest path and updated compatibility matrix.Summary by CodeRabbit
Documentation
Chores
Tests