Babel complains about the parser
danielo515 opened this issue ยท 5 comments
Hello again ๐
When you try to use any parser that is not the default, in my case flow, I get the following error from babel:
SyntaxError: This experimental syntax requires enabling one of the following parser plugin(s): 'flow, typescript' (16:7)
at Parser._raise (/Users/danielo/mega/trabajo/GIT/pento/Pento/client/node_modules/@babel/parser/lib/index.js:810:17)
at Parser.raiseWithData (/Users/danielo/mega/trabajo/GIT/pento/Pento/client/node_modules/@babel/parser/lib/index.js:803:17)
at Parser.expectOnePlugin (/Users/danielo/mega/trabajo/GIT/pento/Pento/client/node_modules/@babel/parser/lib/index.js:9982:18)
at Parser.isExportDefaultSpecifier (/Users/danielo/mega/trabajo/GIT/pento/Pento/client/node_modules/@babel/parser/lib/index.js:13785:16)
at Parser.maybeParseExportDefaultSpecifier (/Users/danielo/mega/trabajo/GIT/pento/Pento/client/node_modules/@babel/parser/lib/index.js:13686:14)
at Parser.parseExport (/Users/danielo/mega/trabajo/GIT/pento/Pento/client/node_modules/@babel/parser/lib/index.js:13639:29)
at Parser.parseStatementContent (/Users/danielo/mega/trabajo/GIT/pento/Pento/client/node_modules/@babel/parser/lib/index.js:12657:27)
at Parser.parseStatement (/Users/danielo/mega/trabajo/GIT/pento/Pento/client/node_modules/@babel/parser/lib/index.js:12551:17)
at Parser.parseBlockOrModuleBlockBody (/Users/danielo/mega/trabajo/GIT/pento/Pento/client/node_modules/@babel/parser/lib/index.js:13140:25)
at Parser.parseBlockBody (/Users/danielo/mega/trabajo/GIT/pento/Pento/client/node_modules/@babel/parser/lib/index.js:13131:10)
I'm using your CLI like this:
npx astx --parser=flow ./src/
How can I "activate" such plugins?
I think it's just that my CLI doesn't support the =
like jscodeshift
uses, can you try --parser flow
without the =
?
Hello @jedwards1211 , I don't know how I ignored your answer. I don't remember what I did for fixing it. I think I used an astx.js file and just exported the parser, but I finally succeeded.
Yeah that's an option too. i need to make it possible to specify in a package.json field as well
Btw if you haven't noticed version 2 beta yet, check it out!
Yep, I saw the note on the banner of the repo. Really exciting stuff