question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for the experimental syntax 'jsx' isn't currently enabled (45:5):

See original GitHub issue

Steps 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 uses jsx 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:open
  • Created 2 years ago
  • Reactions:14
  • Comments:26 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
sarbullcommented, Mar 10, 2022

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.

2reactions
kovkevcommented, Sep 9, 2022

Actually… that helped me. Odd.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found