Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Babel React component #231

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

flolbr
Copy link

@flolbr flolbr commented Oct 18, 2022

When running on a React component with the better-docs/component plugin enabled, this error shows up:

C:\<project_path>\node_modules\better-docs\component.js:68
      throw error
      ^

ConfigError: [BABEL] unknown file: Preset /* your preset */ requires a filename to be set when babel is called directly,
```
babel.transformSync(code, { filename: 'file.ts', presets: [/* your preset */] });
```
See https://babeljs.io/docs/en/options#filename for more information.

It appeared to be caused by the call to reactDocs.parse() in component.js:58.

By passing an empty filename argument (since it is not used anyway), the error stops being thrown and the doc builds fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant