Can't parser JSX
See original GitHub issueSelf closing can parse
> require('meriyah').parse('var a = <div/>', {jsx: true}).body[0].declarations[0].init
{
type: 'JSXElement',
children: [],
openingElement: {
type: 'JSXOpeningElement',
name: { type: 'JSXIdentifier', name: 'div' },
attributes: [],
selfClosing: true
},
closingElement: null
}
but
require('meriyah').parse('var a = <div></div>', {jsx: true}).body[0].declarations[0].init
Uncaught [ParseError [SyntaxError]: [1:20]: Unexpected token
] {
index: 20,
line: 1,
column: 20,
description: '[1:20]: Unexpected token',
loc: { line: 1, column: 20 }
}
Did I do something wrong?
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Jest cannot parse JSX because "support is not enabled", but ...
When I run a custom test, it fails and Jest throws a SyntaxError saying Support for the experimental syntax 'jsx' isn't currently enabled...
Read more >Seems can't parse JSX syntax · Issue #1 · seek-oss/playroom
Seems the webpack can't parse JSX syntax. On a minimalist example I get following error in JS console: index.js:1 Uncaught Error: Module parse...
Read more >JSX In Depth - React
Fundamentally, JSX just provides syntactic sugar for the React.createElement(component, props ... JSX type can't be an expression. return <components[props.
Read more >Why can't browsers read JSX ? - GeeksforGeeks
Browsers can't read JSX because there is no inherent implementation for the browser engines to read and understand them. JSX is not intended ......
Read more >babel/preset-react
@babel/preset-react. This preset always includes the following plugins: @babel/plugin-syntax-jsx · @babel/plugin- ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Wanted to update here that https://github.com/ezolenko/rollup-plugin-typescript2/issues/7 has been fixed by https://github.com/ezolenko/rollup-plugin-typescript2/pull/406 and released in rpt2
0.34.0
🙂Hi 👋 . I help maintain
rollup-plugin-typescript2
nowadays and was looking into old issues and saw this was referenced from https://github.com/ezolenko/rollup-plugin-typescript2/issues/262 .I haven’t been able to reproduce that specific issue and don’t think it’s related to this problem. If you believe this has to do with type-only files per your previous comment
then it could very well be due to https://github.com/ezolenko/rollup-plugin-typescript2/issues/7 instead, which indeed points out that the cache’s module graph may not correctly set dependencies (“One ts file may be affected by multiple ts files”) between modules when it comes to type-only files
Just thought I’d correct that for posterity and future reference, as well as give a possible root cause based on the comments here.