fix(sfc): only enable jsx parser plugin when explicitly using tsx
fix #4106
This commit is contained in:
parent
963085d18c
commit
5df7dfcd71
@ -166,7 +166,10 @@ export function compileScript(
|
||||
scriptLang === 'tsx' ||
|
||||
scriptSetupLang === 'ts' ||
|
||||
scriptSetupLang === 'tsx'
|
||||
const plugins: ParserPlugin[] = [...babelParserDefaultPlugins, 'jsx']
|
||||
const plugins: ParserPlugin[] = [...babelParserDefaultPlugins]
|
||||
if (!isTS || scriptLang === 'tsx' || scriptSetupLang === 'tsx') {
|
||||
plugins.push('jsx')
|
||||
}
|
||||
if (options.babelParserPlugins) plugins.push(...options.babelParserPlugins)
|
||||
if (isTS) plugins.push('typescript', 'decorators-legacy')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user