Skip to content

Commit 40c89e4

Browse files
make rsc get the right rsc bundle path
1 parent 62f19cb commit 40c89e4

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

lib/react_on_rails/utils.rb

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -76,23 +76,23 @@ def self.bundle_js_file_path(bundle_name)
7676
# a. The webpack manifest plugin would have a race condition where the same manifest.json
7777
# is edited by both the webpack-dev-server
7878
# b. There is no good reason to hash the server bundle name.
79-
@server_bundle_path ||= if ReactOnRails::PackerUtils.using_packer? && bundle_name != "manifest.json"
80-
begin
81-
ReactOnRails::PackerUtils.bundle_js_uri_from_packer(bundle_name)
82-
rescue Object.const_get(
83-
ReactOnRails::PackerUtils.packer_type.capitalize
84-
)::Manifest::MissingEntryError
85-
File.expand_path(
86-
File.join(ReactOnRails::PackerUtils.packer_public_output_path,
87-
bundle_name)
88-
)
89-
end
90-
else
91-
# Default to the non-hashed name in the specified output directory, which, for legacy
92-
# React on Rails, this is the output directory picked up by the asset pipeline.
93-
# For Webpacker, this is the public output path defined in the webpacker.yml file.
94-
File.join(generated_assets_full_path, bundle_name)
95-
end
79+
if ReactOnRails::PackerUtils.using_packer? && bundle_name != "manifest.json"
80+
begin
81+
ReactOnRails::PackerUtils.bundle_js_uri_from_packer(bundle_name)
82+
rescue Object.const_get(
83+
ReactOnRails::PackerUtils.packer_type.capitalize
84+
)::Manifest::MissingEntryError
85+
File.expand_path(
86+
File.join(ReactOnRails::PackerUtils.packer_public_output_path,
87+
bundle_name)
88+
)
89+
end
90+
else
91+
# Default to the non-hashed name in the specified output directory, which, for legacy
92+
# React on Rails, this is the output directory picked up by the asset pipeline.
93+
# For Webpacker, this is the public output path defined in the webpacker.yml file.
94+
File.join(generated_assets_full_path, bundle_name)
95+
end
9696
end
9797

9898
def self.server_bundle_js_file_path
@@ -108,15 +108,15 @@ def self.server_bundle_js_file_path
108108
return @server_bundle_path if @server_bundle_path && !Rails.env.development?
109109

110110
bundle_name = ReactOnRails.configuration.server_bundle_js_file
111-
bundle_js_file_path(bundle_name)
111+
@server_bundle_path = bundle_js_file_path(bundle_name)
112112
end
113113

114114
def self.rsc_bundle_js_file_path
115115
return @rsc_bundle_path if @rsc_bundle_path && !Rails.env.development?
116116

117117
# TODO: make it configurable
118118
bundle_name = "rsc-bundle.js"
119-
@server_bundle_path = bundle_js_file_path(bundle_name)
119+
@rsc_bundle_path = bundle_js_file_path(bundle_name)
120120
end
121121

122122
def self.running_on_windows?

0 commit comments

Comments
 (0)