Support for the experimental syntax 'jsx' isn't currently enabled (with solution)
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:
-
add this dependency to your package.json: "@babel/preset-env": "^7.12.13" <--- same version of @babel/preset-react
-
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" -
Subsequently, you have to change Babel's configuration settings. You can do it with an external file
-
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