Skip to content

Add Rspack + RSC compatibility tests and documentation (#1828)#3120

Merged
justin808 merged 4 commits intomainfrom
jg/rspec-rsc-compat
Apr 13, 2026
Merged

Add Rspack + RSC compatibility tests and documentation (#1828)#3120
justin808 merged 4 commits intomainfrom
jg/rspec-rsc-compat

Conversation

@justin808
Copy link
Copy Markdown
Member

@justin808 justin808 commented Apr 12, 2026

Summary

Addresses #1828 — researches and documents whether Rspack works with React on Rails Pro's RSC implementation.

  • Adds 9 new RSpec tests verifying the generated RSC config content is correct for Rspack runtime compatibility (conditionNames, aliases, loader chain, bundler-agnostic plugins, three-bundle routing)
  • Creates docs/pro/react-server-components/rspack-compatibility.md with a compatibility matrix, analysis of react-server-dom-webpack internal API usage, and known limitations

Key Findings

Component Compatible Notes
RSC bundle config Yes Skips WebpackPlugin; uses only loader + resolve
WebpackLoader Yes Standard loader interface
conditionNames / aliases Yes Rspack supports both
LimitChunkCountPlugin Yes Bundler-agnostic via bundler.optimize variable
Loader chain (SWC + Babel) Yes Handles both function and array rule.use
Three-bundle env routing Yes RSC_BUNDLE_ONLY is bundler-agnostic
WebpackPlugin Needs verification Uses webpack internal APIs (ModuleDependency, AsyncDependenciesBlock, compiler hooks)

The RSC bundle itself should work with Rspack today — it only uses the loader and resolve settings. The RSCWebpackPlugin (added to server/client configs for manifest generation) is the one component requiring runtime verification with Rspack v2's compatibility layer.

Test plan

  • bundle exec rspec react_on_rails/spec/react_on_rails/generators/rsc_generator_spec.rb — 76 examples, 0 failures
  • bundle exec rubocop passes on changed files
  • All pre-commit hooks pass

🤖 Generated with Claude Code


Note

Low Risk
Low risk: changes are limited to documentation and RSpec coverage of generated config output, with no runtime or production code modifications.

Overview
Adds a new Pro RSC doc, rspack-compatibility.md, summarizing the current Rspack compatibility status, what parts rely on react-on-rails-rsc, and what still needs runtime verification (notably the manifest-generating plugin).

Expands rsc_generator_spec.rb with a dedicated Rspack runtime-compatibility spec block asserting the generated config/rspack/* RSC configs use bundler-agnostic patterns (e.g., conditionNames, react-dom/server: false, loader-chain handling, skipping RSCWebpackPlugin for the RSC bundle, and RSC_BUNDLE_ONLY routing), and links the new doc into docs/sidebars.ts.

Reviewed by Cursor Bugbot for commit 17708ef. Bugbot is set up for automated code reviews on this repo. Configure here.

Summary by CodeRabbit

  • Documentation

    • Added a Pro guide on React Server Components compatibility with Rspack, describing generator integration, three-bundle architecture, environment routing, compatibility notes, testing checklist, and known limitations.
  • Tests

    • Added specs validating generated Rspack RSC configuration, loader-chain handling, conditional plugin behavior, bundler-agnostic runtime arrangements, and runtime entry/bundle naming outcomes.

Addresses #1828. Adds comprehensive generator specs that verify the
generated RSC config content is correct for Rspack runtime compatibility:
conditionNames, aliases, loader chain handling, bundler-agnostic plugin
usage, and three-bundle env var routing.

Also adds docs/pro/react-server-components/rspack-compatibility.md with a
compatibility matrix, analysis of WebpackPlugin internal API usage, and
known limitations.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 12, 2026

Walkthrough

Adds a new Pro documentation page describing experimental Rspack compatibility for React on Rails Pro’s React Server Components and extends generator specs with assertions that Rspack-specific RSC config files, bundle naming, loader-chain handling, plugin conditionals, and environment-variable routing are generated.

Changes

Cohort / File(s) Summary
Documentation
docs/pro/react-server-components/rspack-compatibility.md
New doc describing experimental Rspack compatibility: generator behavior (creates config/rspack/ RSC configs when assets_bundler: rspack), three-bundle architecture, compatibility matrix (WebpackLoader, rscWebpackConfig.js, conditionNames, resolver aliases), plugin uncertainties, testing checklist, and known limitations.
Test Coverage
react_on_rails/spec/react_on_rails/generators/rsc_generator_spec.rb
Adds Rspack RSC runtime compatibility assertions verifying generated config/rspack/* files: conditionNames includes react-server, alias 'react-dom/server': false, inclusion of react-on-rails-rsc/WebpackLoader, serverWebpackConfig(true), entry renamed to rsc-bundle producing rsc-bundle.js, loader-chain handling for both function and array rule.use, bundler-agnostic chunk-limit plugin usage, conditional skipping of RSCWebpackPlugin({ isServer: true }) when !rscBundle, and process.env.RSC_BUNDLE_ONLY wiring with default three-config array in ServerClientOrBoth.js.
Sidebar
docs/sidebars.ts
Adds the new doc to the Pro React Server Components sidebar under items.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐇 I nibbled docs and hopped through tests,
Rspack and RSC stitched into new vests,
Bundles named, configs penned with glee,
A little rabbit celebrates compatibility! 🌿🥕

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main changes: adding Rspack + RSC compatibility tests and documentation. It is specific, concise, and clearly reflects the primary intent of the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jg/rspec-rsc-compat

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Comment thread react_on_rails/spec/react_on_rails/generators/rsc_generator_spec.rb
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 244703c842

ℹ️ 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".

Comment thread react_on_rails/spec/react_on_rails/generators/rsc_generator_spec.rb Outdated
Comment thread react_on_rails/spec/react_on_rails/generators/rsc_generator_spec.rb Outdated
Comment thread docs/pro/react-server-components/rspack-compatibility.md
Comment thread react_on_rails/spec/react_on_rails/generators/rsc_generator_spec.rb
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Apr 12, 2026

Review Summary

Overall this is a well-scoped PR — documentation-only plus generator spec additions, no runtime behaviour changed. A few things to address before merging:

Must fix

Weak alias assertion (rsc_generator_spec.rb line 682): The test titled "aliases react-dom/server to false" only checks that the string react-dom/server appears in the file, so it would pass even if the false value were removed. Change the assertion to include("'react-dom/server': false").

Unverified citation (rspack-compatibility.md line 52): The sentence "The Rspack team has confirmed … RSC with the JavaScript API" links to #issuecomment-3350629010. That comment ID couldn't be verified during this review — please confirm the URL is live and contains the stated claim. A broken citation in public docs erodes credibility.

Suggestions

  • Duplicate test coverage: Several assertions in the new describe "Rspack RSC runtime compatibility" block (e.g. RSC_BUNDLE_ONLY, rscConfig, RSCWebpackPlugin) are already covered by the "RSC webpack config transforms in config/rspack/" block above. The new tests are intentionally more specific, which is fine — just worth a comment in the spec noting that so future maintainers don't collapse them.

  • Misleading test description (line 704): "handles both function-based (SWC) and array-based (Babel) loader chains" — the test checks for the presence of conditional logic strings, not actual loader insertion. Consider renaming to something like "contains conditional loader-chain handling for both function-based and array-based rule.use".

Looks good

  • The compatibility matrix is accurate and well-structured.
  • The "WebpackPlugin Compatibility Details" section correctly identifies the risk boundary (plugin vs. loader).
  • The generated template assertions are well-matched to actual template content.
  • No security or performance concerns in this change set.

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Apr 12, 2026

Greptile Summary

This PR adds a new documentation page (docs/pro/react-server-components/rspack-compatibility.md) covering the experimental Rspack + RSC status, and extends rsc_generator_spec.rb with 9 new RSpec tests inside a dedicated describe "Rspack RSC runtime compatibility" block nested under the existing context "when Pro is installed on an existing rspack project". No production code is modified. Prior review concerns (weak false-alias assertion, misleading LimitChunkCountPlugin test description) have been fully addressed in ab3fb6dc.

Confidence Score: 5/5

Safe to merge — only documentation and additional generator spec assertions are changed; no production or generator logic is modified.

All findings from prior review rounds are resolved. Both changed files are non-production: one is a markdown doc page (all relative links verified to exist), the other is a spec file adding 9 tests inside an existing generator context with a shared before(:all). No P0 or P1 issues remain.

No files require special attention.

Important Files Changed

Filename Overview
docs/pro/react-server-components/rspack-compatibility.md New documentation page; all relative links resolve to existing files, compatibility matrix is accurate against the test assertions.
react_on_rails/spec/react_on_rails/generators/rsc_generator_spec.rb 9 new tests added under the existing Rspack generator context; all rely on the parent before(:all) setup correctly and use appropriately specific string matchers.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[RSC Generator] --> B{rspack_configured_in_project?}
    B -- Yes --> C[Write to config/rspack/]
    B -- No --> D[Write to config/webpack/]

    C --> E["rscWebpackConfig.js\nconditionNames + react-server alias\nWebpackLoader chain\nserverWebpackConfig(true)"]
    C --> F["serverWebpackConfig.js\nrscBundle param\nif(!rscBundle) RSCWebpackPlugin\nLimitChunkCountPlugin"]
    C --> G["ServerClientOrBoth.js\nRSC_BUNDLE_ONLY routing\nclientConfig + serverConfig + rscConfig"]

    E --> H[rsc-bundle.js\nNo plugin needed]
    F --> I[react-client-manifest.json\nreact-ssr-manifest.json]
    G --> J[Three-bundle build]

    F -.->|Needs Rspack v2 verification| K[RSCWebpackPlugin\nwebpack internal APIs]
Loading

Reviews (2): Last reviewed commit: "Address PR review feedback on RSC genera..." | Re-trigger Greptile

Comment thread react_on_rails/spec/react_on_rails/generators/rsc_generator_spec.rb
Comment thread react_on_rails/spec/react_on_rails/generators/rsc_generator_spec.rb Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
react_on_rails/spec/react_on_rails/generators/rsc_generator_spec.rb (2)

691-695: Add a negative assertion for plugin omission in the RSC bundle config.

This spec currently infers omission via serverWebpackConfig(true) but never asserts the RSC config itself does not include RSCWebpackPlugin.

Suggested assertion hardening
       it "rscWebpackConfig.js passes true to skip RSCWebpackPlugin in RSC bundle" do
         assert_file "config/rspack/rscWebpackConfig.js" do |content|
           expect(content).to include("serverWebpackConfig(true)")
+          expect(content).not_to include("RSCWebpackPlugin")
         end
       end
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@react_on_rails/spec/react_on_rails/generators/rsc_generator_spec.rb` around
lines 691 - 695, The test currently only checks for the presence of
"serverWebpackConfig(true)" in config/rspack/rscWebpackConfig.js; add a negative
assertion to ensure the RSC plugin is omitted by asserting the file content does
not include "RSCWebpackPlugin" (e.g. add an expectation like
expect(content).not_to include("RSCWebpackPlugin") alongside the existing
serverWebpackConfig(true) check in the it block).

679-683: Tighten the alias assertion to verify the compatibility contract.

Line 681 only proves react-dom/server appears somewhere; it does not verify aliasing to false.

Suggested assertion hardening
       it "rscWebpackConfig.js aliases react-dom/server to false for RSC bundle" do
         assert_file "config/rspack/rscWebpackConfig.js" do |content|
-          expect(content).to include("react-dom/server")
+          expect(content).to match(/react-dom\/server['"]?\s*:\s*false/)
         end
       end
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@react_on_rails/spec/react_on_rails/generators/rsc_generator_spec.rb` around
lines 679 - 683, The spec currently only checks that "react-dom/server" appears
in config/rspack/rscWebpackConfig.js; tighten it to assert the actual alias
mapping to false by asserting the exact alias entry (e.g., the string that
represents the alias key/value pair such as '"react-dom/server": false' or
equivalent JSON/JS literal) is present so the test verifies the compatibility
contract; update the example in the "rscWebpackConfig.js aliases
react-dom/server to false for RSC bundle" test in rsc_generator_spec.rb to look
for that exact alias token rather than just the module name.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@react_on_rails/spec/react_on_rails/generators/rsc_generator_spec.rb`:
- Around line 691-695: The test currently only checks for the presence of
"serverWebpackConfig(true)" in config/rspack/rscWebpackConfig.js; add a negative
assertion to ensure the RSC plugin is omitted by asserting the file content does
not include "RSCWebpackPlugin" (e.g. add an expectation like
expect(content).not_to include("RSCWebpackPlugin") alongside the existing
serverWebpackConfig(true) check in the it block).
- Around line 679-683: The spec currently only checks that "react-dom/server"
appears in config/rspack/rscWebpackConfig.js; tighten it to assert the actual
alias mapping to false by asserting the exact alias entry (e.g., the string that
represents the alias key/value pair such as '"react-dom/server": false' or
equivalent JSON/JS literal) is present so the test verifies the compatibility
contract; update the example in the "rscWebpackConfig.js aliases
react-dom/server to false for RSC bundle" test in rsc_generator_spec.rb to look
for that exact alias token rather than just the module name.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5bd52509-d9db-4714-94d1-e97c9153aeb4

📥 Commits

Reviewing files that changed from the base of the PR and between 6e154b2 and 244703c.

📒 Files selected for processing (2)
  • docs/pro/react-server-components/rspack-compatibility.md
  • react_on_rails/spec/react_on_rails/generators/rsc_generator_spec.rb

- Tighten react-dom/server alias assertion to verify the `false` value,
  not just the key name (flagged by 3 reviewers)
- Clarify LimitChunkCountPlugin test originates from Pro generator, not
  the RSC generator
- Rename loader-chain test description to accurately reflect what it checks
- Add comment explaining intentional overlap with earlier assertion block

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@justin808
Copy link
Copy Markdown
Member Author

Review feedback addressed in ab3fb6d

Fixed (4 items):

  1. Tightened alias assertioninclude("react-dom/server")include("'react-dom/server': false") so the test actually verifies the false value (flagged by @claude[bot], @chatgpt-codex-connector[bot], @greptile-apps[bot])
  2. Clarified LimitChunkCountPlugin test origin — renamed test and updated comment to note this content comes from the Pro generator, not the RSC generator (@greptile-apps[bot])
  3. Renamed loader-chain test — now "contains conditional loader-chain handling for function-based and array-based rule.use" to accurately describe what it checks (@claude[bot])
  4. Added duplication rationale — comment above describe block explains overlap with earlier assertions is intentional (@claude[bot])

Skipped (verified):

  • Citation link #issuecomment-3350629010 — confirmed live and accurate; the Rspack team comment exists and states "Currently, Rspack already supports RSC with JavaScript API"

All 76 RSpec examples pass. All 7 review threads resolved.

— I (Claude Code)

@chatgpt-codex-connector
Copy link
Copy Markdown

To use Codex here, create an environment for this repo.

Comment thread react_on_rails/spec/react_on_rails/generators/rsc_generator_spec.rb
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Apr 12, 2026

Follow-up review (commit ab3fb6d)

All four items from the first review are addressed:

  1. Alias assertion tightened — now checks 'react-dom/server': false (line 682). ✓
  2. LimitChunkCountPlugin test renamed and commented — correctly notes the content originates from the Pro generator (line 715). ✓
  3. Loader-chain test renamed — description now accurately says "contains conditional loader-chain handling" rather than implying actual loader insertion (line 707). ✓
  4. Duplication rationale added — the block-level comment at line 667 explains the intentional overlap. ✓

One remaining nit

The test at line 694 verifies the skip via an indirect signal (serverWebpackConfig(true)) but not the direct outcome — see inline comment. Adding not_to include("RSCWebpackPlugin") makes the intent self-documenting and catches template drift. Optional, but recommended.

Documentation

rspack-compatibility.md is accurate and well-structured. One future maintenance note: the linked Rspack RSC support PR (web-infra-dev/rspack/pull/5824) will become stale once merged — consider updating that reference to point to the Rspack changelog or stable docs page when Rspack officially ships RSC support.

No security, performance, or correctness concerns. Safe to merge as-is.

`'use client'` component references during streaming.

**Rspack v2 compatibility**: Rspack v2 has significantly improved webpack plugin
compatibility. The [Rspack team has confirmed](https://github.com/shakacode/react_on_rails/issues/1828#issuecomment-3350629010)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The link to #issuecomment-3350629010 should be verified before merge. Comment IDs in this range (>3 billion, beyond Int32 max) are unusual and this specific anchor may not resolve. If the comment doesn't exist the documentation makes an unverifiable authoritative claim ("The Rspack team has confirmed") that could mislead users. Please open the URL and confirm it loads the intended comment, or remove the anchor link and just cite the issue.

# just the key name). The duplication is intentional.
# See: https://github.com/shakacode/react_on_rails/issues/1828

describe "Rspack RSC runtime compatibility" do
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: the describe name "Rspack RSC runtime compatibility" is misleading — these are generator output tests that assert the content of generated files, not runtime compatibility checks. A name like "Rspack RSC generator output" or "generated Rspack RSC config bundler-agnostic patterns" would more accurately describe what's being tested.

assert_file "config/rspack/serverWebpackConfig.js" do |content|
# This content comes from the Pro generator, not the RSC generator.
# Verified here to ensure the full Rspack server config is bundler-agnostic.
expect(content).to include("bundler.optimize.LimitChunkCountPlugin")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment "This content comes from the Pro generator, not the RSC generator" is misleading. In this test context the file is created by the pro_server_webpack_content fixture in generator_spec_helper.rb, not by actually running the Pro generator. The test's real intent is to verify that the RSC generator's modification of serverWebpackConfig.js doesn't accidentally strip the existing bundler.optimize.LimitChunkCountPlugin call — which is a valid regression guard, but the comment obscures that intent. Suggest replacing with something like: # Regression guard: the RSC generator modifies this file (to add rscBundle param + RSCWebpackPlugin) but must preserve the existing LimitChunkCountPlugin call.

Comment on lines +700 to +705
it "rscWebpackConfig.js renames entry to rsc-bundle" do
assert_file "config/rspack/rscWebpackConfig.js" do |content|
expect(content).to include("'rsc-bundle'")
expect(content).to include("rsc-bundle.js")
end
end
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test asserts two distinct config concerns: the entry key ('rsc-bundle') and the output filename (rsc-bundle.js). These come from separate lines in the generated file (rscConfig.entry assignment and rscConfig.output.filename). Splitting into two focused tests would make failure messages more informative and keep each test at a single concern.

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Apr 12, 2026

Review: #3120 — Rspack + RSC compatibility tests and documentation

Low-risk PR overall. The documentation is clear and the test additions are well-motivated. A few issues worth addressing before merge:

Critical

Unverifiable documentation claim (doc line 52) — The link #issuecomment-3350629010 should be confirmed to resolve before this lands. Comment IDs that large are unusual; if the anchor is wrong the docs make an authoritative "Rspack team has confirmed" claim with a dead link. See inline comment.

Moderate

Misleading comment in test 7 (LimitChunkCountPlugin) — The comment says "This content comes from the Pro generator" but it actually comes from the pro_server_webpack_content fixture in generator_spec_helper.rb. The test intent (regression guard: RSC generator must not remove LimitChunkCountPlugin) is valid, the comment just misrepresents the source. See inline.

Minor

  • describe block name ("Rspack RSC runtime compatibility") — These are generator output assertions, not runtime tests. A name like "generated Rspack RSC config bundler-agnostic patterns" is more accurate.
  • Test 5 mixes two concerns — "renames entry to rsc-bundle" checks both the entry key and the output filename; these are separate config mutations worth splitting.
  • Acknowledged duplication — The overlap with the "RSC webpack config transforms" block (particularly the RSC_BUNDLE_ONLY / rscConfig checks in the ServerClientOrBoth.js test) is called out in the comment, which is good. Just flagging it in case a future reader wonders.

What looks good

  • Compatibility matrix in the doc is accurate and directly traceable to the rscWebpackConfig.js.tt template content.
  • All 9 new specs map to real template strings (verified by reading the template); the assertions themselves are correct.
  • Sidebar placement (upgrading-existing-pro-apprspack-compatibilityglossary) is sensible.
  • The before(:all) setup is shared from the enclosing context — no duplicate fixture setup needed.

The test for serverWebpackConfig(true) now also verifies that
RSCWebpackPlugin is not instantiated in the RSC config, catching
future template drift where the plugin is accidentally added.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@justin808
Copy link
Copy Markdown
Member Author

Follow-up review feedback addressed in 17708ef

Fixed (1 item):

  1. Added negative assertion for RSCWebpackPlugin — the serverWebpackConfig(true) test now also verifies that RSCWebpackPlugin is not instantiated in the RSC config (not_to match(/new\s+RSCWebpackPlugin/)). Used a regex instead of the suggested not_to include("RSCWebpackPlugin") because the template legitimately contains the name in a comment explaining the skip. (@claude[bot])

Skipped (5 items):

  • CodeRabbit walkthrough summary — bot status post, no action needed
  • Initial review summary — all items were already addressed in ab3fb6d
  • Greptile summary ("Safe to merge") — bot status post, no action needed
  • Codex connector setup prompt — bot status post
  • Follow-up review acknowledgment — confirmation that prior fixes were correct (nit captured in TODO for first version #1 above)

All 76 RSpec examples pass. All 8 review threads now resolved.

— I (Claude Code)

@justin808 justin808 merged commit f3cb597 into main Apr 13, 2026
27 checks passed
@justin808 justin808 deleted the jg/rspec-rsc-compat branch April 13, 2026 02:56
justin808 added a commit that referenced this pull request Apr 18, 2026
…ages

* origin/main:
  Fix initial page startup race for late-loading client bundles (#3151)
  chore: apply prettier formatting to tracked docs files (#3153)
  docs: comprehensive RSC API documentation and registration consolidation (#3140)
  Split rspec-package-tests into parallel generator/unit shards (#3134)
  fix: add concurrency groups to long-running CI workflows (#3133)
  refactor: add RenderRequest, JsCodeBuilder, and RenderingStrategy abstractions (#3094)
  fix: address deferred review items from PR #2849 (#3093)
  Add complimentary OSS license policy for React on Rails Pro (#3123)
  fix: centralize CI docs-only detection and add CLI flag validation (#3091)
  refactor: replace stub-throw + Object.assign with capability-based composition (#3096)
  Enhance address-review with parallel fixes, self-review, and Greptile verification (#3121)
  fix: Doctor no longer fails custom projects for missing bin/dev (#3117)
  fix: cap webpack <5.106.0 to prevent ExecJS SSR breakage (#3095)
  Add Rspack + RSC compatibility tests and documentation (#1828) (#3120)
  Add error scenarios hub and test pages (#2497)
  docs: document polyfill requirements for web-targeted server bundles (#3092)
  docs: RSC integration pitfalls from tutorial app (#3087)
  docs: fix render function/helper API documentation (#3088)
  Doctor: accept TS/TSX server bundle suffixes (#3111)
  feat: add CI guard requiring sidebar updates when adding docs (#3089)
justin808 added a commit that referenced this pull request Apr 18, 2026
## Summary

Addresses #1828 —
researches and documents whether Rspack works with React on Rails Pro's
RSC implementation.

- Adds 9 new RSpec tests verifying the generated RSC config content is
correct for Rspack runtime compatibility (conditionNames, aliases,
loader chain, bundler-agnostic plugins, three-bundle routing)
- Creates `docs/pro/react-server-components/rspack-compatibility.md`
with a compatibility matrix, analysis of `react-server-dom-webpack`
internal API usage, and known limitations

### Key Findings

| Component | Compatible | Notes |
|---|---|---|
| RSC bundle config | **Yes** | Skips WebpackPlugin; uses only loader +
resolve |
| WebpackLoader | **Yes** | Standard loader interface |
| conditionNames / aliases | **Yes** | Rspack supports both |
| LimitChunkCountPlugin | **Yes** | Bundler-agnostic via
`bundler.optimize` variable |
| Loader chain (SWC + Babel) | **Yes** | Handles both function and array
`rule.use` |
| Three-bundle env routing | **Yes** | `RSC_BUNDLE_ONLY` is
bundler-agnostic |
| **WebpackPlugin** | **Needs verification** | Uses webpack internal
APIs (`ModuleDependency`, `AsyncDependenciesBlock`, compiler hooks) |

The RSC **bundle** itself should work with Rspack today — it only uses
the loader and resolve settings. The `RSCWebpackPlugin` (added to
server/client configs for manifest generation) is the one component
requiring runtime verification with Rspack v2's compatibility layer.

## Test plan

- [x] `bundle exec rspec
react_on_rails/spec/react_on_rails/generators/rsc_generator_spec.rb` —
76 examples, 0 failures
- [x] `bundle exec rubocop` passes on changed files
- [x] All pre-commit hooks pass

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Low risk: changes are limited to documentation and RSpec coverage of
generated config output, with no runtime or production code
modifications.
> 
> **Overview**
> Adds a new Pro RSC doc, `rspack-compatibility.md`, summarizing the
current Rspack compatibility status, what parts rely on
`react-on-rails-rsc`, and what still needs runtime verification (notably
the manifest-generating plugin).
> 
> Expands `rsc_generator_spec.rb` with a dedicated Rspack
runtime-compatibility spec block asserting the generated
`config/rspack/*` RSC configs use bundler-agnostic patterns (e.g.,
`conditionNames`, `react-dom/server: false`, loader-chain handling,
skipping `RSCWebpackPlugin` for the RSC bundle, and `RSC_BUNDLE_ONLY`
routing), and links the new doc into `docs/sidebars.ts`.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
17708ef. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Documentation**
* Added a Pro guide on React Server Components compatibility with
Rspack, describing generator integration, three-bundle architecture,
environment routing, compatibility notes, testing checklist, and known
limitations.

* **Tests**
* Added specs validating generated Rspack RSC configuration,
loader-chain handling, conditional plugin behavior, bundler-agnostic
runtime arrangements, and runtime entry/bundle naming outcomes.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant