Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for the experimental syntax 'jsx' isn't currently enabled (with solution) #38

Open
Darter90 opened this issue Mar 14, 2021 · 0 comments

Comments

@Darter90
Copy link

I ended up the second book chapter; when I tried to launch npm run watch, Babel throw this error:

Support for the experimental syntax 'jsx' isn't currently enabled

To solve this, you have to:

  1. add this dependency to your package.json:
    "@babel/preset-env": "^7.12.13" <--- same version of @babel/preset-react

  2. Launch npm install. Those are my dependencies at this point:

     "@babel/cli": "^7.13.10",
     "@babel/core": "^7.13.10",
     "@babel/preset-env": "^7.12.13",
     "@babel/preset-react": "^7.12.13",
     "express": "^4.17.1",
     "node": "14.16.0",
     "nodemon": "2.0.7"
    
  3. Subsequently, you have to change Babel's configuration settings.
    You can do it with an external file

  4. At the root folder of your project (where package.json is located), create a new file named "babel.config.js" and add those lines:

     module.exports = {
         presets:[
             "@babel/preset-env",
             "@babel/preset-react"
         ]
     }
    

When I tried to launch again npm run watch, the issue was gone.

Original solution:
https://stackoverflow.com/questions/62703393/support-for-the-experimental-jsx-isnt-currently-enabled

@Darter90 Darter90 changed the title Support for the experimental syntax 'jsx' isn't currently enabled (solution) Support for the experimental syntax 'jsx' isn't currently enabled (with solution) Mar 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant