Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: createViteRuntime should be imported from vite #16067

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion docs/guide/ssr.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ Here `vite` is an instance of [ViteDevServer](./api-javascript#vitedevserver). `
The next step is implementing the `*` handler to serve server-rendered HTML:

```js
import { createViteRuntime } from 'vite'

app.use('*', async (req, res, next) => {
const url = req.originalUrl

Expand All @@ -134,7 +136,7 @@ app.use('*', async (req, res, next) => {
// It fully supports HMR and works in a simillar way to ssrLoadModule
// More advanced use case would be creating a runtime in a separate
// thread or even a different machine using ViteRuntime class
const runtime = await vite.createViteRuntime(server)
const runtime = await createViteRuntime(vite)
const { render } = await runtime.executeEntrypoint('/src/entry-server.js')

// 4. render the app HTML. This assumes entry-server.js's exported
Expand Down