sfc.template && sfc.template.attrs['inherit-attrs'] === 'false'
const scriptLang = script && script.lang
const scriptSetupLang = scriptSetup && scriptSetup.lang
- const isTS = scriptLang === 'ts' || scriptSetupLang === 'ts'
+ const isTS =
+ scriptLang === 'ts' ||
+ scriptLang === 'tsx' ||
+ scriptSetupLang === 'ts' ||
+ scriptSetupLang === 'tsx'
const plugins: ParserPlugin[] = [...babelParserDefaultPlugins, 'jsx']
if (options.babelParserPlugins) plugins.push(...options.babelParserPlugins)
if (isTS) plugins.push('typescript', 'decorators-legacy')
if (!script) {
throw new Error(`[@vue/compiler-sfc] SFC contains no <script> tags.`)
}
- if (scriptLang && scriptLang !== 'ts') {
+ if (scriptLang && !isTS && scriptLang !== 'jsx') {
// do not process non js/ts script blocks
return script
}
)
}
- if (scriptSetupLang && scriptSetupLang !== 'ts') {
+ if (scriptSetupLang && !isTS && scriptSetupLang !== 'jsx') {
// do not process non js/ts script blocks
return scriptSetup
}