fix(compiler-sfc): remove the jsx from the babelParserPlugins when not match the case of adding jsx (#5846)
fix #5845
This commit is contained in:
		
							parent
							
								
									16939241b0
								
							
						
					
					
						commit
						7d7a2410e5
					
				@ -172,6 +172,12 @@ export function compileScript(
 | 
				
			|||||||
  const plugins: ParserPlugin[] = []
 | 
					  const plugins: ParserPlugin[] = []
 | 
				
			||||||
  if (!isTS || scriptLang === 'tsx' || scriptSetupLang === 'tsx') {
 | 
					  if (!isTS || scriptLang === 'tsx' || scriptSetupLang === 'tsx') {
 | 
				
			||||||
    plugins.push('jsx')
 | 
					    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 (options.babelParserPlugins) plugins.push(...options.babelParserPlugins)
 | 
				
			||||||
  if (isTS) plugins.push('typescript', 'decorators-legacy')
 | 
					  if (isTS) plugins.push('typescript', 'decorators-legacy')
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user