facebook / facebook/jscodeshift

Getting missing `exportDefaultFrom` plugin error with `babel` parser, even though it's in `.babelrc`

Open
#303 5 comments 3 reactions 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
10k
Forks
498
PR merge metrics
No merged PRs in 30d

Description

Similar to #256 , in that I'm using Babel parser (_not_ Babylon, because that doesn't actually result in all the modifications I'm expecting to see).

Using both local `npx jscodeshift` and global install.

The **Transform** is getting interpreted fine, it's just the **Parser** is having trouble with my sources (so #245 is not relevant)...

I just get this:

```
ERR src/components/WipeContainer/index.js Transformation error (This experimental syntax requires enabling the parser plugin: 'exportDefaultFrom' (1:7))
SyntaxError: This experimental syntax requires enabling the parser plugin: 'exportDefaultFrom' (1:7)
at Object.raise (~/.config/yarn/global/node_modules/@babel/parser/lib/index.js:3834:17)
at Object.expectPlugin (~/.config/yarn/global/node_modules/@babel/parser/lib/index.js:5147:18)
at Object.parseExport (~/.config/yarn/global/node_modules/@babel/parser/lib/index.js:8209:12)
```

I've tried different `--parser-config jscodeshift.config.json` contents (as JSON, as `module.exports`, using `"plugins": ["exportDefaultFrom"]` vs the normal `.babelrc` format, etc), but the CLI help mentions that this is only for Flow or Babylon.

Here's my `.babelrc` (which I'd expect gets picked up by `jscodeshift` since I can't seem to supply a config any other way?):

```json
{
"presets": [
"env",
"react"
],
"plugins": [
"transform-object-rest-spread",
"transform-export-default"
]
}
```

Babel transpilation works fine. It just seems that jscodeshift isn't picking up on my config?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.