-
Notifications
You must be signed in to change notification settings - Fork 755
Got ES6 with imports working, but prerender fails #303
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
Comments
Looks like ExecJS doesn't support They mention this possibility: https://github.com/cowboyd/commonjs.rb You could try that (and let us know if you have any luck)! |
@rmosolgo Any idea if you'll switch to Babel one day? since it has become integrated in react-tools, it kind of make cense, am I wrong? |
We use Babel for transforming JSX files (on master, as of #295) but supporting |
For other people hitting prerendering issues (since it does use Browserify); It doesn't allow you to use
I might have missed a step, since these are the results of 3 days of getting this thing to work completely. So, what this does is using the browserify-rails gem as a sprockets post-processor to transpile An additional thought; Sorry if this is polluting this issue, but I couldn't find a good guide on integrating CommonJS with React-rails |
I decided to separate a concerns and make Rails just JSON API for client apps. And I feel that it's right way of doing SPAs. Details here: https://github.com/alexfedoseev/generator-flux-on-rails |
Thanks for sharing some solutions here! I'll keep an eye out for forthcoming Rails 5.1 asset changes too, and see if there's anything react-rails can take advantage of. |
Hi there,
I've managed to get a sample app working with Flux, ES6 and the react-rails view helpers and everything is working as long as I don't try to use
prerender: true
in my react component:https://github.com/jlebensold/reactadvisor/blob/master/app/views/restaurants/show.html.erb#L15
I'm using SystemJS to load my modules and have had to make my base component accessible in the root context, however it seems like ExecJS doesn't have the right JavaScript implementation for the module loader. I get this error when I set
prerender: true
in my component:Is there a better way of using module imports without Browserify and Node and with react-rails?
If not, is there another module loader that I could use with Babel that will enable ES6 classes in prerendered code?
My sample project is here and can be started with a
bundle
and arake db:setup
in a few moments:https://github.com/jlebensold/reactadvisor
Thanks for a great gem!
The text was updated successfully, but these errors were encountered: