File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change 33 SFCDescriptor ,
44 BindingMetadata ,
55 shouldTransformRef ,
6- transformRef
6+ transformRef ,
7+ CompilerOptions
78} from 'vue/compiler-sfc'
89import { transform } from 'sucrase'
910
@@ -213,6 +214,9 @@ async function doCompileScript(
213214) : Promise < [ string , BindingMetadata | undefined ] | undefined > {
214215 if ( descriptor . script || descriptor . scriptSetup ) {
215216 try {
217+ const expressionPlugins : CompilerOptions [ 'expressionPlugins' ] = isTS
218+ ? [ 'typescript' ]
219+ : undefined
216220 const compiledScript = store . compiler . compileScript ( descriptor , {
217221 id,
218222 refTransform : true ,
@@ -221,7 +225,7 @@ async function doCompileScript(
221225 ssr,
222226 ssrCssVars : descriptor . cssVars ,
223227 compilerOptions : {
224- expressionPlugins : isTS ? [ 'typescript' ] : undefined
228+ expressionPlugins
225229 }
226230 }
227231 } )
@@ -235,7 +239,11 @@ async function doCompileScript(
235239 }
236240 code +=
237241 `\n` +
238- store . compiler . rewriteDefault ( compiledScript . content , COMP_IDENTIFIER )
242+ store . compiler . rewriteDefault (
243+ compiledScript . content ,
244+ COMP_IDENTIFIER ,
245+ expressionPlugins
246+ )
239247
240248 if ( ( descriptor . script || descriptor . scriptSetup ) ! . lang === 'ts' ) {
241249 code = await transformTS ( code )
You can’t perform that action at this time.
0 commit comments