Skip to content
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

Any interest in a node renderer for reactjs/react-rails? #1079

Open
justin808 opened this issue Jul 17, 2020 · 3 comments
Open

Any interest in a node renderer for reactjs/react-rails? #1079

justin808 opened this issue Jul 17, 2020 · 3 comments

Comments

@justin808
Copy link
Collaborator

I've had a proper node renderer for quite some time for React on Rails Pro.

It's becoming increasingly useful to use NodeJS and not ExecJS for server-side rendering. Here are a few reasons:

  1. loadable-components and CSS in JS Emotion just work when using a proper node server and a build target of node (and not web). I suspect many other libraries are the same in this regard.
  2. Better for memory management
  3. Maybe better performance (and certainly if your Ruby process is running out of memory due to JS leaks)
  4. Options to debug using the Chrome dev tools.
  5. Ability to have SSR code read the file system, make asynch calls, and really anything a proper node program can do.

If there was sufficient interest, I could look into a port of the renderer that worked for react-rails.

@erikt9
Copy link
Contributor

erikt9 commented Jul 17, 2020

I would like to see a proper node renderer for react-rails. For my own project's SSR engine, I've forked https://github.com/jhawthorn/execjs-fastnode (which runs node as an external process but doesn't launch a new process on each render like the default exec-js node renderer) and added some more error handling / logging / integration with react-rails, but I would certainly welcome a more supported node runtime rather than the one I hacked together 😝.

@BookOfGreg
Copy link
Member

Generally I've seen way better performance using miniracer than NodeJS as an ExecJS backend.
I'd be curious to see a benchmark for using NodeJS direct rather than ExecJS as I'm unclear what effect that would have. I'd imagine it would be more similar to when you run the webpack dev server.

Primarily I suspect 1 and 5 would be the most interesting use cases for other folks as some issues are because people coming from pure Node don't have clear paths to making things compatible. 2 and 3 are less interesting I think as I've never personally had issues with memory even on larger deployments of React-Rails.

If you're willing to put in the work it could be interesting.

@justin808
Copy link
Collaborator Author

Generally I've seen way better performance using miniracer than NodeJS as an ExecJS backend.

@BookOfGreg do you remember where you saw such stats?

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

3 participants