From be0f614ac096bdfe44cfddb04c859c9747dcd6dd Mon Sep 17 00:00:00 2001 From: Evan You Date: Fri, 25 Jun 2021 15:56:51 -0400 Subject: [PATCH] feat(sfc-playground): support lang=ts --- packages/sfc-playground/package.json | 3 +- packages/sfc-playground/src/sfcCompiler.ts | 28 +++++++++--- yarn.lock | 52 +++++++++++++++++++++- 3 files changed, 74 insertions(+), 9 deletions(-) diff --git a/packages/sfc-playground/package.json b/packages/sfc-playground/package.json index 2cad1619c66..713a6ac74ca 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 43e7d9facba..8fe74f9ecc1 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