acornjs / acorn-jsx

Alternative, faster React.js JSX parser
MIT License
651 stars 74 forks source link

`parseExpressionAt` throws `SyntaxError: Adjacent JSX elements must be wrapped in an enclosing tag` even though the element is wrapped in an enclosing tag #127

Open Momijiichigo opened 3 years ago

Momijiichigo commented 3 years ago

Target code:

(<div>
    <Header />
</div>)

The code below throws SyntaxError: Adjacent JSX elements must be wrapped in an enclosing tag even though the Header element is wrapped in an enclosing tag:

const MyParser = Parser.extend(
  jsx()
)
console.log(
  MyParser.parseExpressionAt(code, code.indexOf('<Header'), { ecmaVersion: 'latest', sourceType: "module" })
)