Closed dephiros closed 1 year ago
:+1: Let me know if you need something on vite-plugin-ssr
's side to make it work.
cc @DylanPiercey @ryansolid
@dephiros @brillout I'm not sure how good a fit bringing Marko here is.
Mostly because Marko takes full control over the hydration process (IE the equivalent of page.client.jsx
is automated by @marko/vite
).
Not familiar enough with how things are setup in this project to say for sure that this would cause issues though.
Conceptually that should be fine. I don't know about the details, but it could work since vite-plugin-ssr
is quite flexible really.
Someone'd need to dig.
Contribution much welcome to explore this.
Hi,
I am attempted to use this with markojs based on https://github.com/marko-js/examples/tree/master/examples/vite-express but got stuck. Appreciate some pointers
marko
plugin to vite configexport { render }; // See https://vite-plugin-ssr.com/data-fetching export const passToClient = ["pageProps", "urlPathname"];
async function render(pageContext: PageContextBuiltIn & PageContext) { const { Page, pageProps } = pageContext; // const pageHtml = ReactDOMServer.renderToString( //
// <Page {...pageProps} />
//
// );
// See https://vite-plugin-ssr.com/html-head const { documentProps } = pageContext; const title = (documentProps && documentProps.title) || "Vite SSR app"; const desc = (documentProps && documentProps.description) || "App using Vite + vite-plugin-ssr";
const documentHtml = escapeInject`<!DOCTYPE html>