Replies: 2 comments 2 replies
-
|
Hi Cameron! The command exits because For SSR, you'd need to start a server (Fastify, Express, Koa, etc). |
Beta Was this translation helpful? Give feedback.
-
|
@ElMassimo Thanks for the response, sorry been super busy and haven't had chance to respond yet. So here's my confusion, our Ruby on Rails uses this ViteRuby library so we can run an Admin React app inside it and then wildcard the routes for The routes file The and then our However whilst this works great, it means the sever-side HTML for the admin app is always just that root element... which is where SSR would come in... but if we were to try and use Express it would mean requests to the Do you have an example of how we could use SSR with our setup in Rails and then still be able to hydrate it? Or is it not possible to use SSR in the way we have built the app currently? Thanks. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I've followed the documentation at: https://vite-ruby.netlify.app/config/#ssr-options-experimental and built a quick example SSR app to test out if we can do SSR in our Rails app that's using this plugin to add in React JS views... the code is as follows:
ssr.tsxinapp/javascript/ssr/ssr.tsx:We then call:
bin/vite build --ssrwhich results with:And the contents of that built file:
Then I have tried running:
bin/vite ssrto run the SSR version (documentation doesn't mention anymore steps)But the command just runs with no output and then that's it... is there missing step?
In the ViteJS documentation they mention using an express server: https://github.com/bluwy/create-vite-extra/blob/master/template-ssr-react/server.js - but you don't mention this anywhere and it seems implied (even in the Inertia example you provide at: https://github.com/ElMassimo/inertia-rails-ssr-template) that a custom express server isn't required and all the additional parts come built in... the documentation does mention a nodejs file... but all I see generated is that JSX output I provided above.
Can you point me in the correct direction for what's actually missing? or is there a bug from the CLI?
Beta Was this translation helpful? Give feedback.
All reactions