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

Missing documentation for Babel config #13936

Closed
Bikeman868 opened this issue Feb 17, 2021 · 1 comment
Closed

Missing documentation for Babel config #13936

Bikeman868 opened this issue Feb 17, 2021 · 1 comment

Comments

@Bikeman868
Copy link

I spent a long time today trying to make a situation work that it a very common requirement. I spent so long on this because there is no documentation. A very simple 2-3 line description would save many other people from hours of frustration around this issue.

The issue is that if you are building a package that you intend to publish to npm, then you don't want Babel to process Storybook stories and place them in the ./dist folder. I did this by creating a babel.config.json file in the root of my project with instruction to ignore stories, and another babel.config.json file in the .storybook folder that did not ignore stories.

I thought this would work because the Storybook docs say that Storybook runs its build from inside the .storybook folder, but this approach does not in fact work.

After much reading and experimenting I discovered that renaming my Babel config files to .babelrc fixes the problem. This should be included in the docs that talk about configuring Babel for Storybook.

If you want to try this out, my code is here: https://github.com/Bikeman868/react-svg-pie

@jonniebigodes
Copy link
Contributor

@Bikeman868 closing this now as with the release of 6.4 we've updated how Babel works with Storybook and how to set it up. Let us know of any issues/improvements on both the documentation and implementation you might want to see added.

Have a great week.

Stay safe

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

No branches or pull requests

3 participants