Skip to content

Commit faa3ee9

Browse files
committed
clear up unnecessary code
1 parent adade56 commit faa3ee9

File tree

1 file changed

+1
-22
lines changed

1 file changed

+1
-22
lines changed

lib/react/server_rendering/separate_server_bundle_container.rb

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,35 +5,14 @@ module ServerRendering
55
# Get a compiled file from Webpacker's output path
66
class SeparateServerBundleContainer
77

8-
begin
9-
MAJOR, MINOR, PATCH, _ = Bundler.locked_gems.specs.find { |gem_spec| gem_spec.name == 'webpacker' || gem_spec.name == 'shakapacker' }.version.segments
10-
rescue
11-
MAJOR, MINOR, PATCH, _ = [0,0,0]
12-
end
13-
148
def self.compatible?
159
!!defined?(Webpacker)
1610
end
1711

1812
def find_asset(filename)
19-
asset_path = ::Rails.root.join(output_path, filename).to_s
13+
asset_path = Webpacker.config.public_output_path.join(filename).to_s
2014
File.read(asset_path)
2115
end
22-
23-
if MAJOR < 3
24-
def config
25-
Webpacker::Configuration
26-
end
27-
else
28-
def config
29-
Webpacker.config
30-
end
31-
end
32-
33-
def output_path
34-
# Webpack1 /:output/:entry, Webpack3 /public/:output
35-
config.respond_to?(:output_path) ? config.output_path : 'public'
36-
end
3716
end
3817
end
3918
end

0 commit comments

Comments
 (0)