Commit 01fa2ab 1 parent c8c0f74 commit 01fa2ab Copy full SHA for 01fa2ab
File tree 1 file changed +14
-2
lines changed
1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change 4
4
compileTemplate ,
5
5
SFCDescriptor ,
6
6
SFCTemplateCompileOptions ,
7
- SFCTemplateCompileResults
7
+ SFCTemplateCompileResults ,
8
+ CompilerOptions
8
9
} from '@vue/compiler-sfc'
9
10
import { PluginContext , TransformPluginContext } from 'rollup'
10
11
import { ResolvedOptions } from '.'
@@ -157,6 +158,16 @@ export function resolveTemplateCompilerOptions(
157
158
}
158
159
}
159
160
161
+ // if using TS, support TS syntax in template expressions
162
+ const expressionPlugins : CompilerOptions [ 'expressionPlugins' ] =
163
+ options . template ?. compilerOptions ?. expressionPlugins || [ ]
164
+ if (
165
+ descriptor . script ?. lang === 'ts' ||
166
+ descriptor . scriptSetup ?. lang === 'ts'
167
+ ) {
168
+ expressionPlugins . push ( 'typescript' )
169
+ }
170
+
160
171
return {
161
172
...options . template ,
162
173
id,
@@ -173,7 +184,8 @@ export function resolveTemplateCompilerOptions(
173
184
compilerOptions : {
174
185
...options . template ?. compilerOptions ,
175
186
scopeId : hasScoped ? `data-v-${ id } ` : undefined ,
176
- bindingMetadata : resolvedScript ? resolvedScript . bindings : undefined
187
+ bindingMetadata : resolvedScript ? resolvedScript . bindings : undefined ,
188
+ expressionPlugins
177
189
}
178
190
}
179
191
}
You can’t perform that action at this time.
0 commit comments