Browse Source
fix(compiler-sfc): remove the jsx from the babelParserPlugins when not match the case of adding jsx (#5846)
fix #5845
pull/5890/head
小刘(liulinboyi)
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
6 additions and
0 deletions
-
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') |
|
|
|