Class: RailsReactSSR::WebpackerUtils
- Inherits:
-
Object
- Object
- RailsReactSSR::WebpackerUtils
- Defined in:
- lib/rails_react_ssr/webpacker_utils.rb
Class Method Summary collapse
-
.hashed_bundle_name!(bundle) ⇒ Object
Return the hashed name from the
bundle
. -
.open_bundle(bundle, max_tries: 10, delay: 1000) ⇒ Object
Open the
bundle
file for reading.
Class Method Details
.hashed_bundle_name!(bundle) ⇒ Object
Return the hashed name from the bundle
7 8 9 10 11 |
# File 'lib/rails_react_ssr/webpacker_utils.rb', line 7 def self.hashed_bundle_name!(bundle) Webpacker.manifest.lookup! bundle rescue Webpacker::Manifest::MissingEntryError raise RailsReactSSR::MissingBundleError.new(bundle, "The ReactJS package '#{bundle}' is missing from the manifest.json file.") end |
.open_bundle(bundle, max_tries: 10, delay: 1000) ⇒ Object
Open the bundle
file for reading
Returns IO stream with the bundle
contents. If bundle
cannot be found, raises RailsReactSSR::MissingBundleError
18 19 20 21 22 23 24 25 26 |
# File 'lib/rails_react_ssr/webpacker_utils.rb', line 18 def self.open_bundle(bundle, max_tries: 10, delay: 1000) hashed = hashed_bundle_name! bundle if Webpacker.dev_server.running? dev_server_bundle hashed, max_tries, delay else local_file_bundle hashed end end |