From: Evan You Date: Mon, 28 Jun 2021 21:34:52 +0000 (-0400) Subject: chore(sfc-playground): handle ssr-only compile errors X-Git-Tag: v3.1.3~29 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0245c98640d1bff49e101747baf973429962f562;p=thirdparty%2Fvuejs%2Fcore.git chore(sfc-playground): handle ssr-only compile errors --- diff --git a/packages/sfc-playground/src/sfcCompiler.ts b/packages/sfc-playground/src/sfcCompiler.ts index 09e7480539..9f04f2519a 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