Note: as of 3.2.13+, this package is included as a dependency of the main vue package and can be accessed as vue/server-renderer. This means you no longer need to explicitly install this package and ensure its version matches that of vue's. Just use the vue/server-renderer deep import instead.
Basic API
renderToString
Signature
function renderToString( input: App | VNode, context?: SSRContext,): Promise<string>
If the rendered app contains teleports, the teleported content will not be part of the rendered string. Instead, they are exposed under the teleports property of the ssr context object:
function renderToNodeStream(input: App | VNode, context?: SSRContext): Readable
Usage
// inside a Node.js http handlerrenderToNodeStream(app).pipe(res)
Note: This method is not supported in the ESM build of @vue/server-renderer, which is decoupled from Node.js environments. Use pipeToNodeWritable instead.
// TransformStream is available in environments such as CloudFlare workers.// in Node.js, TransformStream needs to be explicitly imported from 'stream/web'const { readable, writable } = new TransformStream()pipeToWebWritable(app, {}, writable)return new Response(readable)
renderToSimpleStream
Renders input in streaming mode using a simple readable interface.