From 0245c98640d1bff49e101747baf973429962f562 Mon Sep 17 00:00:00 2001 From: Evan You Date: Mon, 28 Jun 2021 17:34:52 -0400 Subject: [PATCH] chore(sfc-playground): handle ssr-only compile errors --- packages/sfc-playground/src/sfcCompiler.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/packages/sfc-playground/src/sfcCompiler.ts b/packages/sfc-playground/src/sfcCompiler.ts index 09e74805..9f04f251 100644 --- a/packages/sfc-playground/src/sfcCompiler.ts +++ b/packages/sfc-playground/src/sfcCompiler.ts @@ -97,10 +97,11 @@ export async function compileFile({ filename, code, compiled }: File) { // the render fn is inlined. if (descriptor.scriptSetup) { const ssrScriptResult = await doCompileScript(descriptor, id, true) - if (!ssrScriptResult) { - return + if (ssrScriptResult) { + ssrCode += ssrScriptResult[0] + } else { + ssrCode = `/* SSR compile error: ${store.errors[0]} */` } - ssrCode += ssrScriptResult[0] } else { // when no