atlassian / atlassian/extract-react-types
Babel plugin fails to extract props when project Babel config contains overrides
- Dominant language
- JavaScript
- Stars
- 188
- Forks
- 31
- PR merge metrics
- No merged PRs in 30d
Description
Because we call `babel.parse()` without specifying the [`filename`](https://babeljs.io/docs/en/options#filename) option ([code](https://github.com/atlassian/extract-react-types/blob/a73f91632d43b6a05d4a380c781e8249257e6bc0/packages/babel-plugin-extract-react-types/index.js#L27)), the plugin is not compatible with projects that have overrides in their Babel config.
E.g. if `babel.config.js` contains `overrides: [{ test: '**/*.ts', plugins: ['@babel/plugin-transform-typescript'] }]` then it will silently fail because we ignore errors and Babel cannot determine what config to use for parsing.
The issue explains the problem more thoroughly: https://github.com/babel/babel/issues/11540
Passing `{ filename: '' }` into the `babel.parse()` options appears to fix the issue.
Contributor guide
Assessment
This issue has not been assessed yet.