-
Notifications
You must be signed in to change notification settings - Fork 760
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Setting React Variant To Production Has No Effect #715
Comments
Hi, are you using webpacker or sprockets to build your javascripts? |
Sprockets. Should I switch to webpacker? |
Sprockets is OK! That setting should work for Sprockets ... Just to be sure, is there any other setting in Also, which version of react-rails are you using? Some past versions didn't have the right React.js files :S |
Nothing in |
I'm seeing the same behavior.
still packages the development build when using sprockets/asset pipeline. |
This is still happening, gem version 2.2.1 |
I was having the same issue, but it was because of |
@Bevilacqua, @boxofmattwire or @dklanac is it still happening? Sorry to bother after so long but trying to catch up maintaining. |
I've upgraded to 2.3.1. I'm going to give it another shot today. |
After upgrading, I did a quick test in my local dev by changing the variant setting to I'm still rendering the development build after making these changes. Edit: |
@dklanac can you produce some small reproduction of the issue, or maybe some example code? That example is using React-Rails 2.4.0, Sprockets 3.7.1 |
Thanks for posting this @BookOfGreg. I'm still running into my issue. From what I can tell, here are the key differences from the example app that I see:
I'm running sprockets 3.7.1 too. Maybe there's a config setting that I'm missing with browserify that is there by default for webpack? |
Ooh, this is a good opportunity for me, how are people using browserify with react-rails? If you have an example I'd love to add it as a branch of my example app so I can test these things on it, there are a couple other issues open related to browserify I have so far failed to reproduce too. I'll try react-rails 2.2, rails 4.2, browserify tonight to see if I can reproduce this one. |
+1 |
I was also receiving the After some debugging, I opened the source code on my browser on a rendered page and noticed that my app was loading React v15.6.1, while https://github.com/reactjs/react-rails/blob/master/VERSIONS.md claims that my version of Grepping 'React v15.6.1' on my gems folder made me realize that another gem I am using has React as dependency. On my Gemfile I found:
This gem required But I'm not sure how to solve it. Is there a way to specify from where Sprockets should load the file when I @dklanac maybe you can also check if you have a similar problem (another gem loading another version of React). |
If both gems are serving their own React then the most reliable way of guaranteeing which one you get is to vendor your own. Sprockets should be smart enough to always load the one from This gem serves one version of React for people who do not want to vendor their own but if you have any other react deps, it's probably worth controlling the version of it by hand explicitly. |
👀 |
@ttanimichi has a good point. This is not an issue, people using browserify need to contribute if it's to be documented or supported. Works as intended on sprockets. |
Hi there i am having the same problem, using reactjs (react-rails 2.4.7) through rails asset pipeline config.after_initialize do
config.assets.paths = config.assets.paths -
config.assets.paths.select {|e| e.to_s =~ /lib\/assets\/react-source\/development/}
end if Rails.env.production? in config/application.rb in order to get production variant in production... |
@mpantel, Are you still facing this issue? @BookOfGreg We have reopened this issue. Let's wait for @mpantel response. |
Let's close the issue. |
Help us help you! Please choose one:
react-rails
, so I've included the stack trace and the exact steps which make it crash.react-rails
with another library, but I'm having trouble. I've described my JavaScript management setup (eg, Sprockets, Webpack...), how I'm trying to use this other library, and why it's not working.I have changed my variant to production in
production.rb
withconfig.react.variant = :production
. However, I still get a warning when I push to heroku to my production build that I am using a development version of react.The text was updated successfully, but these errors were encountered: