RFC: Server-side rendering support
nicolassenechal opened this issue · comments
Summary
Add support for SSR
Motivation
SSR is required for performance and SEO
Detailed design
- Generate server.js file consumable by a node server
- Add mechanism to start server in sku
- Add mechanism to server-side hot module reloading in development
- Add mechanism to resolve API calls
How We Teach This
Presented as an alternative when static rendering does not make sense.
Already used by many projects, so acceptance should not be a concern
Drawbacks
Possible confusion with static rendering and ssr
Alternatives
We could have batch jobs crawling our websites regularly and doing static rendering of all the pages and storing them in an S3 bucket.
Unresolved questions
How configurable do we need that server to be?
Is sku in charge of running your production node server? or does it purely output the code?
Also I don't hot reloading should be part of the initial setup for SSR. It's more a nice to have and tbh it's extremely difficult to get working.
The first PR only covers the first point: delivering server.js. The other 3 points are really up to negotiation on which should be done and how.
I think hot module reloading might actually be easier than it sounded initially.
I hope you're right, haven't had much luck with it though. Also, I think hot reloading should be for both static sites and SSR.
will create separate RFCs for missing features