Skip to content

Commit 7d7a241

Browse files
authored
fix(compiler-sfc): remove the jsx from the babelParserPlugins when not match the case of adding jsx (#5846)
fix #5845
1 parent 1693924 commit 7d7a241

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

packages/compiler-sfc/src/compileScript.ts

+6
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,12 @@ export function compileScript(
172172
const plugins: ParserPlugin[] = []
173173
if (!isTS || scriptLang === 'tsx' || scriptSetupLang === 'tsx') {
174174
plugins.push('jsx')
175+
} else {
176+
// If don't match the case of adding jsx, should remove the jsx from the babelParserPlugins
177+
if (options.babelParserPlugins)
178+
options.babelParserPlugins = options.babelParserPlugins.filter(
179+
n => n !== 'jsx'
180+
)
175181
}
176182
if (options.babelParserPlugins) plugins.push(...options.babelParserPlugins)
177183
if (isTS) plugins.push('typescript', 'decorators-legacy')

0 commit comments

Comments
 (0)