-
Notifications
You must be signed in to change notification settings - Fork 256
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
Add babelrc for storybook #217
Conversation
Related storybook issue: storybookjs/storybook#2610 |
There an issue for supporting |
BTW you can try to leave an empty object in |
That's weird, in general it's babel which loads this and this works fine, I've used this pattern with combination with numerous tools. I guess storybook is trying to be clever and re-implements babel config loading on its own (and fails while doing so). I guess this is no biggie and I'd just use this PR's solution - if it works there is no point in searching for a better solution right now. This should get fixed in storybook anyway. babel@7 will come with 'native' |
Unfortunately that's true |
I look at current storybook sources, and seems like it can work if we use
|
Woohoo! I had to extend the (also I tried just keeping it an empty object, but then it can't parse JSX since then it loads no babel presets, rather than just using Storybook defaults). Thanks y'all, you're both awesome. |
When running React Storybook locally, I was getting the following error:
This is easy enough to understand; our
.babelrc
file now looks like this:It appears that for some reason, Storybook config is trying to load this relative to the storybook dir, and failing to find it there.
I tried creating a new
.babelrc
file inside.storybook
, and simply pointing it to../.babelrc.js
, but then it fails with a similar error, trying to open it from a subdirectory:I tried making the path an absolute path with
/.babelrc.js
, no luck.So yeah, my final solution is just to resurrect the former
.babelrc
, just for storybook. This is obviously kind of a gross solution!Because it's a dev-only concern and I wanna get the major version shipped, I may just merge this and deal with it in a subsequent PR, but @Andarist or @Hypnosphi or anyone else, if you have any clues as to how to get Storybook to read .babelrc from the same relative root every time, I'd love to kill this and have both files point to the same
.babelrc.js
.