Skip to content

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

@Darter90

Description

@Darter90

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions