Skip to content

Node runtime required in production #418

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

Closed
ebenoist opened this issue Dec 4, 2015 · 4 comments
Closed

Node runtime required in production #418

ebenoist opened this issue Dec 4, 2015 · 4 comments

Comments

@ebenoist
Copy link

ebenoist commented Dec 4, 2015

Why is node a requirement when running in production if the application is not taking advantage of server side rendering? Could this be configurable?

This seems to be happening simply because execjs is being required, though unless I'm misunderstanding, it shouldn't actually be needed.

Thank you all for your contributions so far, this gem has made integrating react into an existing rails project pretty seamless.

@rmosolgo
Copy link
Member

rmosolgo commented Dec 6, 2015

ExecJS is also required for transforming JSX (by external babel-transpiler or react-rails's JSXTransformer).

It doesn't have to be Node.js -- it could be any of ExecJS's JS runtimes. (AFAIK, therubyracer is the best option for CRuby: #290.)

Maybe you could get away without a JS runtime on your production server if you precompiled assets on a different machine. I'm not sure what it would take to support this in react-rails, but if you can figure it out without too much API change, I'd be on board!

@ebenoist
Copy link
Author

ebenoist commented Dec 6, 2015

Great, the second scenario you describe is exactly my current setup (assets are built on a build server). I'll see if I can whip something up. Would a config setting be the normal way options like this are handled? I did notice that execjs does have a Disabled option for the runtime, and I imagine we can do something similar (or take advantage of that pseudo renderer).

@rmosolgo
Copy link
Member

A config setting would be a great way to handle that!

@ebenoist
Copy link
Author

We actually handled this quite simply by setting the EXECJS_RUNTIME env variable to "DisabledRuntime" in our production environments. This works perfectly! Maybe we can add something in the README or to a config value that sets this runtime?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants