Support for the experimental syntax 'jsx' isn't currently enabled (45:5):
See original GitHub issueSteps to reproduce:
- Create a new react App
- Add https://github.com/Tordek/broken as a dependency (it’s simply a project that contains a file with
.js
extension but usesjsx
syntax. - Attempt to use the component in the app.
Result:
Failed to compile.
../broken/index.js
SyntaxError: D:\XXXX\broken\index.js: Support for the experimental syntax 'jsx' isn't currently enabled (4:13):
2 |
3 | export const Broken = () => {
> 4 | return (<div></div>)
| ^
5 | }
Add @babel/preset-react (https://git.io/JfeDR) to the 'presets' section of your Babel config to enable transformation.
If you want to leave it as-is, add @babel/plugin-syntax-jsx (https://git.io/vb4yA) to the 'plugins' section to enable parsing.
However the offered solution does not work because react-scripts/options/webpack.config.js
disables the babelrc
option.
On the other hand, this problem only seems to exist on Windows; it works fine in Linux.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:14
- Comments:26 (3 by maintainers)
Top Results From Across the Web
Support for the experimental syntax 'jsx' isn't currently enabled
Just create a .babelrc file in the root of your project and add: { "presets": ["@babel/preset-env", "@babel/preset-react"] }.
Read more >Jest error parsing React jsx files “Support for the experimental ...
Jest error parsing React jsx files “Support for the experimental syntax 'jsx' isn't currently enabled”. I ran into this error adding new Jest ......
Read more >Support for the experimental syntax 'jsx' isn't currently enabled
JavaScript : Support for the experimental syntax ' jsx ' isn't currently enabled [ Gift : Animated Search Engine : https://bit.ly/AnimSearch ] ...
Read more >babel/plugin-syntax-jsx
Syntax only. Using this plugin directly only enables Babel to parse this syntax. If you want to transform JSX syntax then use the...
Read more >Babel Config Error: Support for the experimental syntax 'jsx ...
Coding example for the question Babel Config Error: Support for the experimental syntax 'jsx' isn't currently enabled-Reactjs.
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
i’m not that happy to join this club 🥇
Support for the experimental syntax 'jsx' isn't currently enabled
after creating a TypeScript react project and installing an NPM package with react components created with JavaScript.Actually… that helped me. Odd.