Skip to content

Commit e16267c

Browse files
committed
Add React 19 webpack config to Pro dummy app
Missing conditionNames configuration was causing Pro dummy tests to fail. The Pro dummy uses Node renderer and needs the React 19 webpack setup. Fixes CI failures in: - examples (3.4, latest) - examples (3.2, minimum) - dummy-app-integration-tests
1 parent 1bbdd06 commit e16267c

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

react_on_rails_pro/spec/dummy/config/webpack/serverWebpackConfig.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,21 @@ const configureServer = (rscBundle = false) => {
118118

119119
// If using the default 'web', then libraries like Emotion and loadable-components
120120
// break with SSR. The fix is to use a node renderer and change the target.
121-
// If using the React on Rails Pro node server renderer, uncomment the next line
121+
// React 19 requires target: 'node' to properly handle Node.js built-in modules
122122
serverWebpackConfig.target = 'node';
123123

124124
serverWebpackConfig.node = false;
125125

126+
// React 19 Fix: Prevent webpack from resolving to react-server condition
127+
// The server-bundle needs the full React with hooks for SSR, not the react-server build
128+
// Explicitly set conditionNames without react-server
129+
if (!serverWebpackConfig.resolve) {
130+
serverWebpackConfig.resolve = {};
131+
}
132+
// For target: 'node', webpack defaults to ['node', 'import', 'require', 'default']
133+
// We explicitly list them to ensure react-server is not included
134+
serverWebpackConfig.resolve.conditionNames = ['node', 'import', 'require', 'default'];
135+
126136
return serverWebpackConfig;
127137
};
128138

0 commit comments

Comments
 (0)