From 66d75d9b47ff843de59241ada4090aabac9eb3d1 Mon Sep 17 00:00:00 2001 From: Toan Nguyen Date: Mon, 11 Sep 2017 17:16:35 +1000 Subject: [PATCH] Webpack API changes Webpack has changed their public API in this PR: https://github.com/rails/webpacker/pull/636 This PR allows `react-rails` to work with the latest webpacker version. --- lib/generators/react/install_generator.rb | 4 ++-- lib/react/server_rendering/webpacker_manifest_container.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/generators/react/install_generator.rb b/lib/generators/react/install_generator.rb index a3d4b6d21..9d0378190 100644 --- a/lib/generators/react/install_generator.rb +++ b/lib/generators/react/install_generator.rb @@ -60,8 +60,8 @@ def webpacker? def javascript_dir if webpacker? - Webpacker::Configuration.source_path - .join(Webpacker::Configuration.entry_path) + Webpacker.config.source_path + .join(Webpacker.config.entry_path) .relative_path_from(::Rails.root) .to_s else diff --git a/lib/react/server_rendering/webpacker_manifest_container.rb b/lib/react/server_rendering/webpacker_manifest_container.rb index 2f15e5736..8db756540 100644 --- a/lib/react/server_rendering/webpacker_manifest_container.rb +++ b/lib/react/server_rendering/webpacker_manifest_container.rb @@ -12,7 +12,7 @@ class WebpackerManifestContainer def find_asset(logical_path) # raises if not found - asset_path = Webpacker::Manifest.lookup(logical_path).to_s + asset_path = Webpacker.manifest.lookup(logical_path).to_s if asset_path.start_with?("http") # Get a file from the webpack-dev-server dev_server_asset = open(asset_path).read @@ -21,7 +21,7 @@ def find_asset(logical_path) dev_server_asset else # Read the already-compiled pack: - full_path = Webpacker::Manifest.lookup_path(logical_path).to_s + full_path = ::Rails.root.join(File.join(Webpacker.config.public_path, Webpacker.manifest.lookup(logical_path))).to_s File.read(full_path) end end