# Change Log All notable changes to this project's source code will be documented in this file. Items under `Unreleased` is upcoming features that will be out in next version. NOTE: major versions of the npm module and the gem must be kept in sync. 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] Changes since last non-beta release. *Please add entries here for your pull requests.* - Fix regression where `react_component(... prerender: true)` wouldn't find the generated asset bundle, because it wasn't looking for the hashed path. ## 9.0 from 8.x. Upgrade Instructions All 9.0.0 beta versions can be viewed in [PR 908](https://github.com/shakacode/react_on_rails/pull/908) - Breaking Configuration Changes 1. Added `config.node_modules_location` which defaults to `""` if Webpacker is installed. You may want to set this to 'client'` to `config/initializers/react_on_rails.rb` to keep your node_modules inside of `/client` 2. Renamed * config.npm_build_test_command ==> config.build_test_command * config.npm_build_production_command ==> config.build_production_command - Update the gemfile. Switch over to using the webpacker gem. ```rb gem "webpacker" ``` - Update for the renaming in the `WebpackConfigLoader` in your webpack configuration. You will need to rename the following object properties: - webpackOutputPath ==> output.path - webpackPublicOutputDir ==> output.publicPath - hotReloadingUrl ==> output.publicPathWithHost - hotReloadingHostname ==> settings.dev_server.host - hotReloadingPort ==> settings.dev_server.port - hmr ==> settings.dev_server.hmr - manifest ==> Remove this one. We use the default for Webpack of manifest.json - env ==> Use `const { env } = require('process'); - devBuild ==> Use `const devBuild = process.env.NODE_ENV !== 'production'; - Edit your Webpack.config files: - Change your Webpack output to be like: ``` const webpackConfigLoader = require('react-on-rails/webpackConfigLoader'); const configPath = resolve('..', 'config'); const { output, settings } = webpackConfigLoader(configPath); const devBuild = process.env.NODE_ENV !== 'production'; output: { filename: isHMR ? '[name]-[hash].js' : '[name]-[chunkhash].js', chunkFilename: '[name]-[chunkhash].chunk.js', publicPath: output.publicPath, path: output.path, }, ``` - Change your ManifestPlugin definition to something like the following ``` new ManifestPlugin({ publicPath: output.publicPath, writeToFileEmit: true }), ``` - Find your `webpacker_lite.yml` and rename it to `webpacker.yml` - Add a default setting ``` cache_manifest: false ``` - For production, set: ``` cache_manifest: true ``` - Add a section like this under your development env: ``` dev_server: host: localhost port: 3035 hmr: false ``` Set hmr to your preference. - See the example `spec/dummy/config/webpacker.yml`. - Remove keys `hot_reloading_host` and `hot_reloading_enabled_by_default`. These are replaced by the `dev_server` key. - Rename `webpack_public_output_dir` to `public_output_path`. - Edit your Procfile.dev - Remove the env value WEBPACKER_DEV_SERVER as it's not used - For hot loading: - Set the `hmr` key in your `webpacker.yml` to `true`. #### Troubleshooting ### [9.0.0] *Diffs for the beta to master* ### [9.0.0-beta.12] - Updated for latest rails/webpacker using the official gem - hot reloading working in generator ### [9.0.0-beta.11] - Updated for latest rails_webpacker. - hot reloading working in spec/dummy ### [9.0.0-beta.10] - Updated for the latest rails/webpacker. Added the cache_manifest setting. ### [9.0.0-beta.9] - Fixes precompile task going to Webpacker's. You need to set `custom_compile: true` in your `webpacker.yml`. - Changed webpack-bundle.js name to hello-world-bundle.js - Update for latest from rails/webpacker gem "webpacker", git: "https://github.com/shakacode/webpacker.git", branch: "issue-464-merge-webpacker-lite-into-webpacker-v3" ### [9.0.0-beta.8] - bugfix for server rendering ### [9.0.0-beta.7] - Depend on updated rails/webpacker in branch gem "webpacker", git: "https://github.com/shakacode/webpacker.git", branch: "issue-464-merge-webpacker-lite-into-webpacker-v2" ### [9.0.0-beta.6] - Change "hot" to "hmr". ### [9.0.0-beta.3] - Fix typo on webpackConfigLoader.js ### [9.0.0-beta.3] - Fix typo on webpackConfigLoader.js ### [9.0.0-beta.2] - Fixed problems when running in development mode for both the generator and spec/dummy. ### [9.0.0-beta.1] - First version of depending on Webpacker rather than Webpacker Lite ### [8.0.7] #### fixed - Fixes generator bug by keeping blank line at top in case existing .gitignore does not end in a newline. [#916](https://github.com/shakacode/react_on_rails/pull/916) by [justin808](https://github.com/justin808). ### [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). Be sure to update webpacker_lite to 2.1.0. - 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/886) by [justin808](https://github.com/justin808). - All tests run against Rails 5.1.2 *Note: 8.0.4 skipped.* ## [8.0.3] ### Fixed - Ruby 2.1 issue due to `<<~` as reported in [issue #870](https://github.com/shakacode/react_on_rails/issues/870). [#867](https://github.com/shakacode/react_on_rails/pull/867) by [justin808](https://github.com/justin808) ## [8.0.2] ### Fixed - Any failure in webpack to build test files quits tests. - Fixed a Ruby 2.4 potential crash which could cause a crash due to pathname change in Ruby 2.4. - CI Improvements: - Switched to yarn link and removed relative path install of react-on-rails - Removed testing of Turbolinks 2 - All tests run against Rails 5.1.1 - Fixed test failures against Ruby 2.4 - [#862](https://github.com/shakacode/react_on_rails/pull/862) by [justin808](https://github.com/justin808) ## [8.0.1] ### Fixed - Generator no longer modifies `assets.rb`. [#859](https://github.com/shakacode/react_on_rails/pull/859) by [justin808](https://github.com/justin808) ## [8.0.0] - Generators and full support for [webpacker_lite](https://github.com/shakacode/webpacker_lite) - No breaking changes to move to 8.0.0 other than the default for this setting changed to nil. If you depended on the default of this setting and are using the asset pipeline (and not webpacker_lite), then add this to your `config/initializers/react_on_rails.rb`: ``` symlink_non_digested_assets_regex: /\.(png|jpg|jpeg|gif|tiff|woff|ttf|eot|svg|map)/, ``` - For an example of migration, see: [react-webpack-rails-tutorial PR #395](https://github.com/shakacode/react-webpack-rails-tutorial/pull/395) - For a simple example of the webpacker_lite setup, run the basic generator. ## [8.0.0-beta.3] - 2017-05-27 ### Changed - Major updates for WebpackerLite 2.0.2. [#844](https://github.com/shakacode/react_on_rails/pull/845) by [justin808](https://github.com/justin808) with help from ](https://github.com/robwise) - Logging no longer occurs when trace is turned to false. [#845](https://github.com/shakacode/react_on_rails/pull/845) by [conturbo](https://github.com/Conturbo) ## [8.0.0-beta.2] - 2017-05-08 ### Changed Removed unnecessary values in default paths.yml files for generators. [#834](https://github.com/shakacode/react_on_rails/pull/834) by [justin808](https://github.com/justin808). ## [8.0.0-beta.1] - 2017-05-03 ### Added Support for WebpackerLite in the generators. [#822](https://github.com/shakacode/react_on_rails/pull/822) by [kaizencodes](https://github.com/kaizencodes) and [justin808](https://github.com/justin808). ### Changed Breaking change is that the default value of symlink_non_digested_assets_regex has changed from this old value to nil. This is a breaking change if you didn't have this value set in your config/initializers/react_on_rails.rb file and you need this because you're using webpack's CSS features and you have not switched to webpacker lite. ``` symlink_non_digested_assets_regex: /\.(png|jpg|jpeg|gif|tiff|woff|ttf|eot|svg|map)/, ``` ## [7.0.4] - 2017-04-27 - Return empty json when nil in json_safe_and_pretty [#824](https://github.com/shakacode/react_on_rails/pull/824) by [dzirtusss](https://github.com/dzirtusss) ## [7.0.3] - 2017-04-27 Same as 7.0.1. ## 7.0.2 - 2017-04-27 *Accidental release of beta gem here* ## [7.0.1] - 2017-04-27 ### Fixed - Fix to handle nil values in json_safe_and_pretty [#823](https://github.com/shakacode/react_on_rails/pull/823) by [dzirtusss](https://github.com/dzirtusss) ## [7.0.0] - 2017-04-25 ### Changed - Any version differences in gem and node package for React on Rails throw an error [#821](https://github.com/shakacode/react_on_rails/pull/821) by [justin808](https://github.com/justin808) ### Fixed - Fixes serious performance regression when using String props for rendering. [#821](https://github.com/shakacode/react_on_rails/pull/821) by [justin808](https://github.com/justin808) ## [6.10.1] - 2017-04-23 ### Fixed - Improve json conversion with tests and support for older Rails 3.x. [#787](https://github.com/shakacode/react_on_rails/pull/787) by [cheremukhin23](https://github.com/cheremukhin23) and [Ynote](https://github.com/Ynote). ## [6.10.0] - 2017-04-13 ### Added - Add an ability to return multiple HTML strings in a `Hash` as a result of `react_component` method call. Allows to build `` contents with [React Helmet](https://github.com/nfl/react-helmet). [#800](https://github.com/shakacode/react_on_rails/pull/800) by [udovenko](https://github.com/udovenko). ### Fixed - Fix PropTypes, createClass deprecation warnings for React 15.5.x. [#804](https://github.com/shakacode/react_on_rails/pull/804) by [udovenko ](https://github.com/udovenko). ## [6.9.3] - 2017-04-03 ### Fixed - Removed call of to_json on strings when formatting props. [#791](https://github.com/shakacode/react_on_rails/pull/791) by [justin808](https://github.com/justin808). ## [6.9.2] - 2017-04-02 ### Changed - Update version_checker.rb to `logger.error` rather than `logger.warn` for gem/npm version mismatch. [#788](https://github.com/shakacode/react_on_rails/issues/788) by [justin808](https://github.com/justin808). ### Fixed - Remove pretty formatting of JSON in development. [#789](https://github.com/shakacode/react_on_rails/pull/789) by [justin808](https://github.com/justin808) - Clear hydrated stores with each server rendered block. [#785](https://github.com/shakacode/react_on_rails/pull/785) by [udovenko](https://github.com/udovenko) ## [6.9.1] - 2017-03-30 ### Fixed - Fixes Crash in Development for String Props. [#784](https://github.com/shakacode/react_on_rails/issues/784) by [justin808](https://github.com/justin808). ## [6.9.0] - 2017-03-29 ### Fixed - Fixed error in the release script. [#767](https://github.com/shakacode/react_on_rails/issues/767) by [isolo](https://github.com/isolo). ### Changed - Use