Skip to content

Commit 2ea74d9

Browse files
committed
Fix packs generator error when server_bundle_js_file is empty (#1802)
* 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.
1 parent d536634 commit 2ea74d9

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ After a release, please make sure to run `bundle exec rake update_changelog`. Th
2323

2424
Changes since the last non-beta release.
2525

26+
#### Bug Fixes
27+
28+
- **Packs generator**: Fixed error when `server_bundle_js_file` configuration is empty (default). Added safety check to prevent attempting operations on invalid file paths when server-side rendering is not configured. [PR 1802](https://github.com/shakacode/react_on_rails/pull/1802)
29+
2630
### [16.0.1-rc.2] - 2025-09-20
2731

2832
#### Bug Fixes

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)