Skip to content

Commit

Permalink
fix(compiler-sfc): remove the jsx from the babelParserPlugins when no…
Browse files Browse the repository at this point in the history
…t match the case of adding jsx (#5846)

fix #5845
  • Loading branch information
liulinboyi committed May 10, 2022
1 parent 1693924 commit 7d7a241
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/compiler-sfc/src/compileScript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit 7d7a241

Please sign in to comment.