Skip to content

Commit 92306ff

Browse files
justin808claude
andcommitted
Fix CI: resolve RSC bundle and server bundle build errors
Two issues: 1. RSC bundle (127 errors): Remove server-bundle-generated.js import from rsc-bundle.js. It includes RouterApp.server.jsx (traditional SSR component) that uses react-redux/react-router with client-only React APIs incompatible with the react-server condition. Client references are handled automatically by the RSC loader/plugin. 2. Server bundle (3 errors): Add Node.js builtin fallbacks (path, fs, stream) to server webpack config. react-on-rails-pro now includes RSC modules that import these builtins, but they aren't used in the traditional SSR path. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent aaeba86 commit 92306ff

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

client/app/packs/rsc-bundle.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@
33
// It imports the same client component registrations as server-bundle.js,
44
// plus the server component registrations.
55

6-
// Import existing client component registrations
6+
// Import stores registration (has 'use client' — RSC loader replaces with client reference)
77
import './stores-registration';
8-
import './../generated/server-bundle-generated.js';
98

109
// React Server Components registration (server-side)
10+
// Note: server-bundle-generated.js is NOT imported here because it contains
11+
// traditional SSR components (e.g., RouterApp.server.jsx) that use client-only
12+
// React APIs (useState, Component, etc.) incompatible with the react-server condition.
13+
// Client component references are handled automatically by the RSC loader/plugin.
1114
import registerServerComponent from 'react-on-rails-pro/registerServerComponent/server';
1215
import ServerComponentsPage from '../bundles/server-components/ServerComponentsPage';
1316

config/webpack/serverWebpackConfig.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,17 @@ const configureServer = () => {
171171
'react-dom/server.browser.js$': 'react-dom/server.node.js',
172172
};
173173

174+
// react-on-rails-pro includes RSC-related modules that import Node.js builtins
175+
// (path, fs, stream). These code paths aren't used in the traditional SSR bundle,
176+
// so provide empty fallbacks to avoid resolution errors.
177+
serverWebpackConfig.resolve.fallback = {
178+
...serverWebpackConfig.resolve.fallback,
179+
path: false,
180+
fs: false,
181+
'fs/promises': false,
182+
stream: false,
183+
};
184+
174185
return serverWebpackConfig;
175186
};
176187

0 commit comments

Comments
 (0)