Error: Line 1: Unexpected token >
at ErrorHandler.constructError (...\node_modules\esprima\dist\esprima.js:5012:22)
at ErrorHandler.createError (...\node_modules\esprima\dist\esprima.js:5028:27)
at JSXParser.Parser.unexpectedTokenError (...\node_modules\esprima\dist\esprima.js:1985:39)
at JSXParser.Parser.throwUnexpectedToken (...\node_modules\esprima\dist\esprima.js:1995:21)
at JSXParser.parseJSXIdentifie ( ...\node_modules\esprima\dist\esprima.js:724:19)
at JSXParser.parseJSXElementName (...\node_modules\esprima\dist\esprima.js:730:33)
at JSXParser.parseJSXOpeningElement (...\node_modules\esprima\dist\esprima.js:817:26)
at JSXParser.parseJSXElement (...\node_modules\esprima\dist\esprima.js:926:29)
at JSXParser.parseJSXRoot (...\node_modules\esprima\dist\esprima.js:942:29)
at JSXParser.parsePrimaryExpression (...\node_modules\esprima\dist\esprima.js:466:40)
I found an issue from esprima, but it was fixed long ago. Also I found a recast issue, but it had different error and provided no details on solution
Current workaround that I found is to pass babel parser, but esprima can handle this case, so I'm confused why it's happening
import * as babelParser from 'recast/parsers/babel';
parse('<></>', {parser: babelParser}); // parses with no issues
Steps to reproduce
Expected result
A Program is returned with JSXFragmen expression
Actual result
An error is thrown
I found an issue from esprima, but it was fixed long ago. Also I found a recast issue, but it had different error and provided no details on solution
Current workaround that I found is to pass babel parser, but esprima can handle this case, so I'm confused why it's happening
Any idea on why is it happening?