You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
vitepress/src/client/app/ssr.ts

13 lines
374 B

// entry for SSR
import { createApp } from './index.js'
import { renderToString } from 'vue/server-renderer'
import type { SSGContext } from '../shared.js'
export async function render(path: string) {
const { app, router } = await createApp()
await router.go(path)
const ctx: SSGContext = { content: '' }
ctx.content = await renderToString(app, ctx)
return ctx
}