I'm setting up a new React app, which I haven't done in some time, and running into what I think is a simple problem. When I run npm run build I get this error:
SyntaxError: /Users/.../Projects/MyProject/frontend/src/App.js: Support for the experimental syntax 'jsx' isn't currently enabled (8:5):
6 | function App() {
7 | return (
> 8 | <div className='App'>
| ^
9 | <header className='app-header'>
10 | <h1>Welcome!</h1>
I'm using Javascript and Flow. I followed the instructions to get Flow working, which involved installing Babel. I sense this is where the problem lies.
Here's my package.json file:
{
"name": "frontend",
"main": "lib/index.js",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.4.0",
"@testing-library/user-event": "^7.2.1",
"flow-bin": "^0.130.0",
"node-sass": "^4.14.1",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-scripts": "3.4.1"
},
"scripts": {
"start": "react-scripts start",
"build": "babel src/ -d lib/",
"prepublish": "npm run build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"flow": "flow"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"@babel/cli": "^7.10.5",
"@babel/core": "^7.10.5",
"@babel/preset-flow": "^7.10.4"
}
}
Might anyone know what the problem is?