0

I am using react-rails gem in order to use React within Rails. Since I upgraded react-rails gem version to 2.0.2, it started giving me warning

application-0a65875….js:1842 Warning: It looks like you're using a minified copy of the development build of React. When deploying React apps to production, make sure to use the production build which skips development warnings and is faster...

Inside config/environments/production.rb, I have

config.react.variant = :production

Any idea how to fix this?

Sebin
  • 1,044
  • 1
  • 8
  • 21
  • Did you restart the server after you changed the initializer? Also `ENV['NODE_ENV']` should be sat to eq `ENV['RAILS_ENV']` but doesn't hurt to make sure it's production in both cases. – radubogdan Apr 19 '17 at 07:12
  • I figured out the issue. But not solved. I am using `rails-assets-react-bootstrap` gem from rails-assets.org, which has dependency on `rails-assets-react` which loads uncompressed version of react. Is there any way we can mention which react to choose from? – Sebin Apr 19 '17 at 07:48
  • Good find! Try to read their source code and check if there is a variable that you can change to get the compressed version in the pipeline. If you can't find it I suggest you fork the gem, change the source to use the compressed version and point the gem to your github repo. – radubogdan Apr 19 '17 at 08:58
  • You basically include the `require react` directive in your application.js file. I'm wondering what happens if you minify that with uglifier. Did you already do that? http://guides.rubyonrails.org/asset_pipeline.html#precompiling-assets – radubogdan Apr 19 '17 at 09:07
  • ^ I am doing just this. Hence the warning. React has two builds - development and production. Warning says I am using compressed version of development build. Appreciate your help, thanks. – Sebin Apr 19 '17 at 10:16

0 Answers0