feat(server-renderer): decouple esm build from Node + improve stream API

- deprecate `renderToSTream`
- added `renderToNodeStream`
- added `renderToWebStream`
- added `renderToSimpleStream`

close #3467
close #3111
close #3460
This commit is contained in:
Evan You
2021-07-29 13:12:50 -04:00
parent 0affd4daf4
commit 08672222c6
7 changed files with 271 additions and 12 deletions

View File

@@ -16,6 +16,14 @@ export function ssrCompile(
template: string,
instance: ComponentInternalInstance
): SSRRenderFunction {
if (!__NODE_JS__) {
throw new Error(
`On-the-fly template compilation is not supported in the ESM build of ` +
`@vue/server-renderer. All templates must be pre-compiled into ` +
`render functions.`
)
}
const cached = compileCache[template]
if (cached) {
return cached