I'm following https://medium.com/swlh/how-to-setup-a-react-js-project-from-scratch-e746a77ffed4 to set up a React project manually.
My bable.config.json contains:
% more bable.config.json
{
"presets": [
"@babel/preset-env",
"@babel/preset-react"
],
"comments": false
}
When executing npx babel index.jsx --out-dir lib I get this error:
SyntaxError: frontend-react/index.jsx: Support for the experimental syntax 'jsx' isn't currently enabled (10:5):
8 | const App = () => {
9 | return (
> 10 | <>
| ^
11 | <h1>Congrats!</h1>
12 | <h3>You have successfully setup React.JS from scratch</h3>
13 | </>
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.
at Parser._raise (frontend-react/node_modules/@babel/parser/lib/index.js:541:17)
at Parser.raiseWithData (frontend-react/node_modules/@babel/parser/lib/index.js:534:17)
at Parser.expectOnePlugin (frontend-react/node_modules/@babel/parser/lib/index.js:3602:18)
at Parser.parseExprAtom (frontend-react/node_modules/@babel/parser/lib/index.js:11961:18)
at Parser.parseExprSubscripts (frontend-react/node_modules/@babel/parser/lib/index.js:11564:23)
at Parser.parseUpdate (frontend-react/node_modules/@babel/parser/lib/index.js:11544:21)
at Parser.parseMaybeUnary (frontend-react/node_modules/@babel/parser/lib/index.js:11519:23)
at Parser.parseMaybeUnaryOrPrivate (frontend-react/node_modules/@babel/parser/lib/index.js:11333:61)
at Parser.parseExprOps (frontend-react/node_modules/@babel/parser/lib/index.js:11340:23)
at Parser.parseMaybeConditional (frontend-react/node_modules/@babel/parser/lib/index.js:11310:23) {
loc: Position { line: 10, column: 4 },
pos: 337,
missingPlugin: [ 'jsx', 'flow', 'typescript' ],
code: 'BABEL_PARSE_ERROR'
}
It seems like the bable.config.json file isn't used.
I read and tried all answers I could find (like adding .bablerc, etc.) but nothing helped or worked.
The missingPlugin error looks suspicious to me but might be a side effect.
So, how to find out what's going on or is there anything else I could try?