Estoy siguiendo https://medium.com/swlh/how-to-setup-a-react-js-project-from-scratch-e746a77ffed4 para configurar un proyecto React manualmente.
Mi bable.config.json contiene:
% more bable.config.json { "presets": [ "@babel/preset-env", "@babel/preset-react" ], "comments": false } Al ejecutar npx babel index.jsx --out-dir lib me sale este 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' } Parece que el archivo bable.config.json no se usa.
Leí y probé todas las respuestas que pude encontrar (como agregar .bablerc, etc.) pero nada ayudó ni funcionó.
El error de missingPlugin me parece sospechoso, pero podría ser un efecto secundario.
Entonces, ¿cómo averiguar qué está pasando o hay algo más que pueda intentar?