diff --git a/packages/compiler-sfc/src/compileScript.ts b/packages/compiler-sfc/src/compileScript.ts index 0433d5b9..f6a63996 100644 --- a/packages/compiler-sfc/src/compileScript.ts +++ b/packages/compiler-sfc/src/compileScript.ts @@ -53,10 +53,9 @@ export function compileScript( const hasCssVars = styles.some(s => typeof s.attrs.vars === 'string') - const isTS = - (script && script.lang === 'ts') || - (scriptSetup && scriptSetup.lang === 'ts') - + const scriptLang = script && script.lang + const scriptSetupLang = scriptSetup && scriptSetup.lang + const isTS = scriptLang === 'ts' || scriptSetupLang === 'ts' const plugins: ParserPlugin[] = [ ...(options.babelParserPlugins || []), ...babelParserDefautPlugins, @@ -67,6 +66,10 @@ export function compileScript( if (!script) { throw new Error(`SFC contains no