From: Evan You Date: Fri, 25 Jun 2021 19:56:51 +0000 (-0400) Subject: feat(sfc-playground): support lang=ts X-Git-Tag: v3.1.3~42 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=be0f614ac096bdfe44cfddb04c859c9747dcd6dd;p=thirdparty%2Fvuejs%2Fcore.git feat(sfc-playground): support lang=ts --- diff --git a/packages/sfc-playground/package.json b/packages/sfc-playground/package.json index 2cad1619c6..713a6ac74c 100644 --- a/packages/sfc-playground/package.json +++ b/packages/sfc-playground/package.json @@ -22,6 +22,7 @@ }, "dependencies": { "file-saver": "^2.0.5", - "jszip": "^3.6.0" + "jszip": "^3.6.0", + "sucrase": "^3.19.0" } } diff --git a/packages/sfc-playground/src/sfcCompiler.ts b/packages/sfc-playground/src/sfcCompiler.ts index 43e7d9facb..8fe74f9ecc 100644 --- a/packages/sfc-playground/src/sfcCompiler.ts +++ b/packages/sfc-playground/src/sfcCompiler.ts @@ -59,17 +59,24 @@ export async function compileFile({ filename, code, compiled }: File) { } if ( - (descriptor.script && descriptor.script.lang) || - (descriptor.scriptSetup && descriptor.scriptSetup.lang) || descriptor.styles.some(s => s.lang) || (descriptor.template && descriptor.template.lang) ) { store.errors = [ - 'lang="x" pre-processors are not supported in the in-browser playground.' + `lang="x" pre-processors for