diff --git a/packages/compiler-sfc/src/compileScript.ts b/packages/compiler-sfc/src/compileScript.ts index 7c84f29b..7c16bcc8 100644 --- a/packages/compiler-sfc/src/compileScript.ts +++ b/packages/compiler-sfc/src/compileScript.ts @@ -172,6 +172,12 @@ export function compileScript( const plugins: ParserPlugin[] = [] if (!isTS || scriptLang === 'tsx' || scriptSetupLang === 'tsx') { plugins.push('jsx') + } else { + // If don't match the case of adding jsx, should remove the jsx from the babelParserPlugins + if (options.babelParserPlugins) + options.babelParserPlugins = options.babelParserPlugins.filter( + n => n !== 'jsx' + ) } if (options.babelParserPlugins) plugins.push(...options.babelParserPlugins) if (isTS) plugins.push('typescript', 'decorators-legacy')