From 3e82da9814cd5dadc9fe2d22884f223dcce34a87 Mon Sep 17 00:00:00 2001 From: Justin Gordon Date: Tue, 18 Jul 2017 22:07:06 -1000 Subject: [PATCH] Update WebpackerLite 2.1 fixes server rendering Uses new helper pack_path to get the path of the server bundle without worrying about any CDN set in the asset_host. --- CHANGELOG.md | 12 ++++++------ Gemfile | 2 +- lib/react_on_rails/utils.rb | 3 ++- spec/dummy/Gemfile | 2 +- spec/dummy/Gemfile.lock | 4 ++-- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d42288da2..9f481b984 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,21 +4,21 @@ All notable changes to this project's source code will be documented in this fil Contributors: please follow the recommendations outlined at [keepachangelog.com](http://keepachangelog.com/). Please use the existing headings and styling as a guide, and add a link for the version diff at the bottom of the file. Also, please update the `Unreleased` link to compare to the latest release version. ## [Unreleased] -### [8.0.6] -#### fixed -- The package.json file created by the generator now creates minified javascript production builds by default. This was done by adding the -p flag to webpack on the build:production script. - Changes since last non-beta release. *Please add entries here for your pull requests.* -- Fixes GitUtils.uncommitted_changes? throwing an error when called in an environment without Git, and allows install generator to be run successfully with `--ignore-warnings` [#878](https://github.com/shakacode/react_on_rails/pull/878) by [jasonblalock](https://github.com/jasonblalock) +### [8.0.6] +#### fixed +- Fixes server rendering when using a CDN. Server rendering would try to fetch a file with the "asset_host". This change updates the webpacker_lite dependency to 2.1.0 which has a new helper `pack_path`. [#901](https://github.com/shakacode/react_on_rails/pull/901) by [justin808](https://github.com/justin808). +- The package.json file created by the generator now creates minified javascript production builds by default. This was done by adding the -p flag to webpack on the build:production script. [#895](https://github.com/shakacode/react_on_rails/pull/895) by [serodriguez68 ](https://github.com/serodriguez68) +- Fixes GitUtils.uncommitted_changes? throwing an error when called in an environment without Git, and allows install generator to be run successfully with `--ignore-warnings` [#878](https://github.com/shakacode/react_on_rails/pull/878) by [jasonblalock](https://github.com/jasonblalock). ## [8.0.5] ### fixed - Corrects `devBuild` value for webpack production build from webpackConfigLoader. [#877](https://github.com/shakacode/react_on_rails/pull/877) by [chenqingspring](https://github.com/chenqingspring). - Remove contentBase deprecation warning message. [#878](https://github.com/shakacode/react_on_rails/pull/878) by [ened ](https://github.com/ened). - - Removes invalid reference to _railsContext in the generated files. [#886](https://github.com/shakacode/react_on_rails/pull/8876) by [justin808](https://github.com/justin808) + - Removes invalid reference to _railsContext in the generated files. [#886](https://github.com/shakacode/react_on_rails/pull/886) by [justin808](https://github.com/justin808). - All tests run against Rails 5.1.2 *Note: 8.0.4 skipped.* diff --git a/Gemfile b/Gemfile index 31b2531b6..367024241 100644 --- a/Gemfile +++ b/Gemfile @@ -38,6 +38,6 @@ gem "chromedriver-helper" gem "launchy" gem "poltergeist" gem "selenium-webdriver" -gem "webpacker_lite" +gem "webpacker_lite", "~> 2.1" gem "rainbow" diff --git a/lib/react_on_rails/utils.rb b/lib/react_on_rails/utils.rb index 7fc029733..b54d3c1c0 100644 --- a/lib/react_on_rails/utils.rb +++ b/lib/react_on_rails/utils.rb @@ -72,7 +72,8 @@ def self.bundle_js_file_path(bundle_name) if using_webpacker_lite? && WebpackerLite::Manifest.lookup(bundle_name) # If using webpacker_lite gem - public_subdir_hashed_file_name = ActionController::Base.helpers.asset_pack_path(bundle_name) + # Per https://github.com/rails/webpacker/issues/571, this path might + public_subdir_hashed_file_name = ActionController::Base.helpers.pack_path(bundle_name) return File.join("public", public_subdir_hashed_file_name) end diff --git a/spec/dummy/Gemfile b/spec/dummy/Gemfile index 1452d84d8..0a4c32fb8 100644 --- a/spec/dummy/Gemfile +++ b/spec/dummy/Gemfile @@ -41,7 +41,7 @@ gem "sdoc", group: :doc gem "react_on_rails", path: "../.." -gem "webpacker_lite", "2.0.4" +gem "webpacker_lite", "2.1.0" gem "mini_racer" diff --git a/spec/dummy/Gemfile.lock b/spec/dummy/Gemfile.lock index 6476d8e9f..67be84d22 100644 --- a/spec/dummy/Gemfile.lock +++ b/spec/dummy/Gemfile.lock @@ -276,7 +276,7 @@ GEM uglifier (3.2.0) execjs (>= 0.3.0, < 3) unicode-display_width (1.2.1) - webpacker_lite (2.0.4) + webpacker_lite (2.1.0) activesupport (>= 4.2) multi_json (~> 1.2) railties (>= 4.2) @@ -326,7 +326,7 @@ DEPENDENCIES sqlite3 turbolinks (~> 5.0) uglifier - webpacker_lite (= 2.0.4) + webpacker_lite (= 2.1.0) BUNDLED WITH 1.15.1