vite-plugin-ssr has been renamed Vike, see migration guide.

render() hook

The render() hook defines how a page is rendered to HTML.

// /**/*.page.server.js (usually /renderer/_default.page.server.js)
// Environment: server

import { escapeInject, dangerouslySkipEscape } from 'vite-plugin-ssr/server'
import { renderToHtml, createElement } from 'some-ui-framework'

export { render }

async function render(pageContext){
  const { Page, pageProps } = pageContext
  const pageHtml = await renderToHtml(createElement(Page, pageProps))

  const documentHtml = escapeInject`<!DOCTYPE html>
        <title>My SSR App</title>
        <div id="page-root">${dangerouslySkipEscape(pageHtml)}</div>

  return {
    pageContext: {
      // We can add some `pageContext` here

pageContext.Page is the export { Page } of the page's .page.js file that is being rendered.