- Notifications
You must be signed in to change notification settings - Fork 750
Code taken from patch done by ownerscircle fork #383
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
Conversation
| Awesome! It would be great to get a test for this behavior, too. I think you could:
|
| @rmosolgo I'm writing up a test but having an issue digesting your suggested test: What do I put here? if I try to put react.js or anything, it says it can't find the file (and that kills the test) if I just put: then I get this error: |
| Oh, i guess you could just leave it blank and use the default Yes, those files aren't there yet. Normally, they'd be moved to that location by Then it might find them! |
| @rmosolgo A few points:
I guess this leads me to believe the patch code from earlier etc doesn't work at all and this is a minor fools errand :) Thoughts? |
| I don't think it's a fool's errand, but it's just unfamiliar territory for me! I'm sure it's possible to do this "right", but it involves digging around in a bunch of Sprockets APIs to figure out how to make it work 😬 |
| I'm going to illicit some help from my Rails expert cohorts (i'm the scala, clojure, ember, angular, backbone, react person) haha. Thanks for all the help/feedback, hopefully I can get this thing working soon :) |
| @rmosolgo btw - closed this for 2 reasons. 1) was just very stale/already pushed/I love rebase/didn't want to force push haha 2) Found another approach with the help of a coworker/friend (who i'll get his public github and get him the credit asap).. anyway -- going to push up a new branch/PR with this done another way w/ a test etc. |
| I'm having the same issue where my assets are not found in ::Rails.application.assets[filename].to_s. This change actually fixes it. |
| @dfguo hrm. How are you using/testing it? The issue for me, is that once I "go to prod" my application-hash.js "has react in it" (and everything else right :)? and my server side rendering is trying to "find react.js" and I haven't been able to figure out (using the manifest cache/anything) how to resolve that. do you have anything like this in your applications.rb: Maybe my issue is that I can have that "for dev", but for prod I actually have to make sure NOT to specify those? |
| @rstudner yes, similar problem. I'm not sure why in prod my file returns as nil when calling Take note that my set up is slightly different, I use webpack to generate one final bundle file: |
| Ahh yeah, I'm almost to using webpack with this project and then i'd do the exact same as above. So when you arent using webpack, the problem is that it looks for the files in that list, and of course, they don't exist (since they've been Sprocketed hah). Have you seen the gem react_on_rails? Solid support for doing webpack w/ rails etc. I didn't realize you could easily do webpack w/ rails and still use this particular gem (i'm behind in reading the docs, clearly) How do you have webpack configured to work with your rails app and this gem (if you don't mind sharing) |
| @rstudner it's actually fairly simple. We did a sharing at Ruby Conf China this year. Video: https://www.youtube.com/watch?v=3G4SFsl5p6s TLDR version: output the webpack generated bundle to app/assets/javascript/bundle folder and let Rails sprocket load it. We have been using react-rails gem purely for server-side rendering. Honestly, it's a bit bloated for what we use it for. |
master...ownerscircle:perf_testing
I tested this pretty thoroughly locally, but I'm also not a rails expert so i'd love for someone else to pull this down and try it in a production/pre-compiled environment.