Skip to content

Commit 2d4c790

Browse files
committed
Fix ReactOnRails::PackerUtils.using_packer? compatibility with react_on_rails 16.0
The using_packer? method was removed in react_on_rails 16.0 as part of the transition to Shakapacker-only support. Since Shakapacker is now assumed to always be in use, the check is no longer needed. Changes: - Remove using_packer? check from Utils.bundle_file_name method - Remove mock of non-existent method from spec - Update comments to reference Shakapacker instead of webpacker Fixes CI failures in utils_spec.rb
1 parent f9abd84 commit 2d4c790

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

lib/react_on_rails_pro/utils.rb

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,21 +65,17 @@ def self.rsc_bundle_hash
6565
@rsc_bundle_hash = calc_bundle_hash(server_rsc_bundle_js_file_path)
6666
end
6767

68-
# Returns the hashed file name when using webpacker. Useful for creating cache keys.
68+
# Returns the hashed file name when using Shakapacker. Useful for creating cache keys.
6969
def self.bundle_file_name(bundle_name)
70-
unless ReactOnRails::PackerUtils.using_packer?
71-
raise ReactOnRailsPro::Error, "Only call bundle_file_name if using webpacker"
72-
end
73-
7470
# bundle_js_uri_from_packer can return a file path or a HTTP URL (for files served from the dev server)
7571
# Pathname can handle both cases
7672
full_path = ReactOnRails::PackerUtils.bundle_js_uri_from_packer(bundle_name)
7773
pathname = Pathname.new(full_path)
7874
pathname.basename.to_s
7975
end
8076

81-
# Returns the hashed file name of the server bundle when using webpacker.
82-
# Necessary fragment-caching keys.
77+
# Returns the hashed file name of the server bundle when using Shakapacker.
78+
# Necessary for fragment-caching keys.
8379
def self.server_bundle_file_name
8480
return @server_bundle_hash if @server_bundle_hash && !Rails.env.development?
8581

spec/react_on_rails_pro/utils_spec.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ module ReactOnRailsPro
1212
.and_return("public/webpack/production")
1313
allow(Shakapacker).to receive_message_chain("config.public_output_path")
1414
.and_return("public/webpack/production")
15-
allow(ReactOnRails::PackerUtils).to receive(:using_packer?).and_return(true)
1615
end
1716

1817
describe ".bundle_file_name" do

0 commit comments

Comments
 (0)