-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Babel configuration problems in 6.4.0-rc.8 with and without babelModeV7
#16789
Comments
I've investigated this, and it seems that though everything -at least- works, there's an issue located in the CRA preset. I can confirm cases 2 & 3: in fact I have established that the presence of |
according to @shilman |
I can see |
After a bunch of debugging, it seems like there were just version mismatches. I was able to make your example work: |
Just so you know:
should do absolutely nothing for the preview application in a CRA setup, the CRA preset already overloads the entire webpack & babel config. |
Thanks for spending the time debugging @ndelangen. So the presets will take priority over user defined Babel configuration? Also, the migration docs mention that the |
It's up to the presets to take the previous config and change it however they see fit, and return new config. We CRA preset, essentially throws away provided config, and replaces it with some config internal from CRA. |
Thanks for the response. But, as I mentioned, considering that the .babelrc with the Storybook directory is not supported anymore, how could one create a Storybook specific Babel config if presets can override the entire thing? |
Describe the bug
Related issues: #12745, #14425, #12292
Related PR: #15928
When updating to
@storybook/[email protected]
, the whole Babel configuration doesn't behave as expected.On
@storybook/[email protected]
, if I have nobabelrc
file, Storybook is able to infer controls fromReact.PropTypes
correctly. If I add my custombabelrc
, then it breaks (as explained in this comment).When I update to
@storybook/[email protected]
and not enabling thebabelModeV7
, I expect Storybook to behave exactly like it would on6.3.x
. However, even without a custombabelrc
, mypropTypes
are not parsed correctly.If I enable
babelModeV7
and runnpx sb@next babelrc
to generate the defaultbabelrc
from previous versions, the file gets correctly generated. I install the missing dependencies and then I expect it to behave the same way as6.3.x
. However, mypropTypes
still do not work.To Reproduce
I provided a minimal reproduction case. I scaffolded a barebones app with CRA, then used
npx sb init
to initialize Storybook. From then, I removed all the examples except for theButton
component. I have converted that example from TypeScript back tojsx
. You can take the following steps to confirm my problem:Working case
@storybook/react@latest
.babelrc.json
and disablebabelModeV7
npm run storybook
Broken case 1
.babelrc.json
npm run storybook
Broken case 2
@storybook/react@next
(6.4.0-rc.8 at the time of writing).babelrc.json
file (now we are in the same state as working case above)npm run storybook
@latest
Broken case 3
npx sb@next babelrc
to generate the babel configuration file, or use the one provided in the repopackage.json
)babelModeV7
npm run storybook
storybook-babel-mrc.zip
System
The text was updated successfully, but these errors were encountered: