Skip to content

Commit 29cae23

Browse files
justin808claude
andcommitted
Fix packs generator error when server_bundle_js_file is empty
Add safety check to prevent PacksGenerator from attempting operations on invalid file paths when server_bundle_js_file is not configured. The configuration defaults to empty string when server-side rendering is not enabled, which would cause the method to construct malformed file paths and potentially fail. This change follows the existing pattern used elsewhere in the class where server_bundle_js_file.present? is checked before operations. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 8481a3d commit 29cae23

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

lib/react_on_rails/packs_generator.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ def generated_server_pack_file_content
164164

165165
def add_generated_pack_to_server_bundle
166166
return if ReactOnRails.configuration.make_generated_server_bundle_the_entrypoint
167+
return if ReactOnRails.configuration.server_bundle_js_file.empty?
167168

168169
relative_path_to_generated_server_bundle = relative_path(server_bundle_entrypoint,
169170
generated_server_bundle_file_path)

0 commit comments

Comments
 (0)