Skip to content

Commit 7fcef62

Browse files
committed
Use React on Rails default 'ssr-generated' for server bundle path
Per code review, use the documented default value 'ssr-generated' for server_bundle_output_path instead of a custom path. This follows the React on Rails 16 conventions and matches the framework defaults.
1 parent 27df4bc commit 7fcef62

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

.gitignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ lib/bs
5454
client/app/bundles/comments/rescript/**/*.bs.js
5555

5656
# Server-side rendering bundles (private)
57-
app/assets/builds/
57+
# Using React on Rails default directory
58+
/ssr-generated/
5859

5960
# Generated files
60-
client/app/generated/
61-
ssr-generated/
61+
/client/app/generated/

config/initializers/react_on_rails.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616

1717
# Server bundle output path for private SSR bundles (React on Rails 16+)
1818
# This keeps server bundles separate from public assets for security
19-
config.server_bundle_output_path = "app/assets/builds"
19+
# Using the default from React on Rails docs
20+
config.server_bundle_output_path = "ssr-generated"
2021

2122
# React on Rails 16 compatibility: Workaround for removed error handling
2223
#

config/webpack/serverWebpackConfig.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,14 @@ const configureServer = () => {
4646
// Custom output for the server-bundle that matches the config in
4747
// config/initializers/react_on_rails.rb
4848
// Output to a private directory for SSR bundles (not in public/)
49+
// Using the default React on Rails path: ssr-generated
4950
const path = require('path');
5051
serverWebpackConfig.output = {
5152
filename: 'server-bundle.js',
5253
globalObject: 'this',
5354
// If using the React on Rails Pro node server renderer, uncomment the next line
5455
// libraryTarget: 'commonjs2',
55-
path: path.resolve(__dirname, '../../app/assets/builds'),
56+
path: path.resolve(__dirname, '../../ssr-generated'),
5657
publicPath: config.publicPath,
5758
// https://webpack.js.org/configuration/output/#outputglobalobject
5859
};

0 commit comments

Comments
 (0)