You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(generator): scaffold native RSCRspackPlugin for rspack RSC (#3488)
When `assets_bundler: rspack` is detected, the RSC generator now scaffolds the
native `RSCRspackPlugin` (from `react-on-rails-rsc/RspackPlugin`) for the server
and client bundles instead of `RSCWebpackPlugin`. 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 under Rspack's compat layer producing
valid-looking manifests that still failed ~7/11 RSC routes at runtime, while the
native `RSCRspackPlugin` (standard rspack public APIs, same manifest schema)
rendered and hydrated all routes. The two plugins share the same
`{ isServer, clientReferences }` API, so this is a drop-in swap.
Changes:
- Add `rsc_plugin_class_name` / `rsc_plugin_import_path` helpers to GeneratorHelper
(single source of truth, keyed on `using_rspack?`).
- Branch the base server/client webpack-config templates on those helpers.
- Parameterize the standalone-upgrade migration (rsc_setup + client_references)
by bundler, and broaden the plugin-detection regex to match both
`RSCWebpackPlugin` and `RSCRspackPlugin` so re-run idempotency stays correct
(the fresh `--rsc --rspack` install runs the migration on top of the template).
- Update user-facing migration warnings to name the active bundler's plugin.
- Update docs/pro/.../rspack-compatibility.md to reflect the native-plugin pivot
(kept "experimental" — the stable package + CI gate are still pending in #3488).
Targets `react-on-rails-rsc@19.0.5-rc.5`, which exports `./RspackPlugin`.
Refs #3488
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
# Rspack Compatibility with React Server Components
2
2
3
-
> **Status**: Experimental — generator support is complete; runtime verification is in progress.
3
+
> **Status**: Experimental — the generator scaffolds the native Rspack plugin and the proven runtime path, but the end-to-end gate is not yet wired into this repo's CI. See [issue #3488](https://github.com/shakacode/react_on_rails/issues/3488).
4
4
5
5
This page documents the compatibility status of [Rspack](https://rspack.dev/) with React on Rails Pro's React Server Components (RSC) implementation.
6
6
7
7
## Overview
8
8
9
9
React on Rails Pro's RSC implementation uses a three-bundle architecture (client, server, RSC).
10
-
The generator already supports Rspack — when `assets_bundler: rspack` is detected in `shakapacker.yml`, all RSC config files are created in `config/rspack/` instead of `config/webpack/`.
10
+
The generator supports Rspack — when `assets_bundler: rspack` is detected in `shakapacker.yml`, all RSC config files are created in `config/rspack/` instead of `config/webpack/`, and the server/client configs are scaffolded with the **native `RSCRspackPlugin`** instead of `RSCWebpackPlugin`.
11
11
12
-
The RSC implementation depends on the `react-on-rails-rsc` npm package, which provides:
12
+
The RSC implementation depends on the `react-on-rails-rsc` npm package, which provides bundler-specific manifest plugins plus a shared loader:
-**WebpackLoader** — transforms `'use client'` files into client reference proxies in the RSC bundle
14
+
-**WebpackPlugin** (`react-on-rails-rsc/WebpackPlugin`) — generates client/server component manifest files under webpack.
15
+
-**RspackPlugin** (`react-on-rails-rsc/RspackPlugin`) — the rspack-native equivalent (`RSCRspackPlugin`). It emits the **same manifest JSON schema** using only standard rspack public APIs, so the RSC runtime resolves client references identically. Exported from `react-on-rails-rsc` 19.0.5 and later.
16
+
-**WebpackLoader** (`react-on-rails-rsc/WebpackLoader`) — transforms `'use client'` files into client reference proxies in the RSC bundle. Works under both webpack and rspack.
16
17
17
18
## Compatibility Matrix
18
19
@@ -24,54 +25,53 @@ The RSC implementation depends on the `react-on-rails-rsc` npm package, which pr
24
25
|**`resolve.alias`** (`react-dom/server: false`) | Yes | Rspack supports alias to `false`|
25
26
|**`LimitChunkCountPlugin`**| Yes | Generated configs use bundler-agnostic `bundler.optimize.LimitChunkCountPlugin`|
26
27
|**Loader chain (SWC + Babel)**| Yes | Generated config handles both `function` and `Array``rule.use` styles |
|**Manifest plugin** (`RSCRspackPlugin`) | Yes | Native rspack plugin; emits the same manifest schema (see below) |
29
+
|**WebpackPlugin** (`react-on-rails-rsc/WebpackPlugin`) | Not used on rspack | Replaced by `RSCRspackPlugin` under rspack; remains the webpack-only plugin |
0 commit comments