parent
f7c54caeb1
commit
01e8ba8f87
@ -101,7 +101,11 @@ export function compileScript(
|
||||
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')
|
||||
@ -110,7 +114,7 @@ export function compileScript(
|
||||
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
|
||||
}
|
||||
@ -156,7 +160,7 @@ export function compileScript(
|
||||
)
|
||||
}
|
||||
|
||||
if (scriptSetupLang && scriptSetupLang !== 'ts') {
|
||||
if (scriptSetupLang && !isTS && scriptSetupLang !== 'jsx') {
|
||||
// do not process non js/ts script blocks
|
||||
return scriptSetup
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user