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
Second of three stacked sub-PRs in the Pro RSC migration. Routes all
server rendering through the Pro Node renderer (port 3800) instead of
ExecJS, and flips the asset bundler from rspack to webpack — scoped
reversal of #702, needed because rspack 2.0.0-beta.7's webpack
compatibility layer doesn't cover the APIs upstream RSCWebpackPlugin
requires. We flip back to rspack once shakacode/react_on_rails_rsc#29
ships a native rspack RSC plugin.
The bundler flip and NodeRenderer wiring ship atomically: the server
bundle produced by the Pro webpack transforms (target: 'node' +
libraryTarget: 'commonjs2') is not evaluable by ExecJS, so the
initializer pointing server_renderer at the NodeRenderer must land at
the same time.
Key changes:
- config/shakapacker.yml: assets_bundler: rspack → webpack
- config/webpack/bundlerUtils.js: return @rspack/core or webpack based
on the shakapacker setting (was rspack-only and threw otherwise);
spec updated in parallel
- config/webpack/serverWebpackConfig.js: Pro transforms per the :pro
generator's update_webpack_config_for_pro and the marketplace/dummy
references — target: 'node' + node: false, libraryTarget:
'commonjs2', extractLoader helper, babelLoader.options.caller =
{ ssr: true }, destructured module.exports so Sub-PR 3's
rscWebpackConfig.js can derive from serverWebpackConfig(true).
RSCWebpackPlugin({ isServer: true }) when !rscBundle emits the
server manifest; inert until Sub-PR 3 activates RSC support
- config/initializers/react_on_rails_pro.rb: NodeRenderer-only config
(no RSC fields — those move in Sub-PR 3)
- renderer/node-renderer.js: launcher with strict integer env parsing,
CI worker cap, and additionalContext: { URL, AbortController } so
react-router-dom's NavLink.encodeLocation does not throw
"ReferenceError: URL is not defined" at SSR time
- Procfile.dev: renderer: NODE_ENV=development node renderer/node-renderer.js
- package.json: react-on-rails-pro-node-renderer 16.6.0 and
react-on-rails-rsc ^19.0.4 (Pro peer dep; required for the
RSCWebpackPlugin import)
- .gitignore: /renderer/.node-renderer-bundles/
- .env.example: REACT_ON_RAILS_PRO_LICENSE, RENDERER_PASSWORD, and
REACT_RENDERER_URL with dev vs prod guidance
- .github/workflows/rspec_test.yml: start the Node renderer before
rspec with PID liveness and port-ready checks plus log capture on
failure
Verified locally: webpack build compiles cleanly. `bin/rails s` on
3000 with `node renderer/node-renderer.js` on 3800 renders GET /
at HTTP 200; Rails log shows "Node Renderer responded" and the
renderer log emits "[SERVER] RENDERED Footer to dom node with id:
..." — confirming SSR went through the Pro path rather than falling
back to ExecJS.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments