-
-
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
React - use babel presets/plugins based on CRA. #4836
Conversation
Codecov Report
@@ Coverage Diff @@
## next #4836 +/- ##
==========================================
- Coverage 35.45% 35.42% -0.03%
==========================================
Files 560 560
Lines 6846 6857 +11
Branches 919 922 +3
==========================================
+ Hits 2427 2429 +2
- Misses 3935 3942 +7
- Partials 484 486 +2
Continue to review full report at Codecov.
|
Tests will be fixed after #4837 |
TBH, I don't like this preset =( We can just add support for the SVGR and dynamic imports independently. |
I think SVGR by default for any React app should be safe. If they're justing the import within an |
I am not sure about |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you considered using this? It might be a more robust solution than configuring Babel yourself.
https://www.npmjs.com/package/babel-preset-react-app
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great - tho I agree about the fs
comment from @mrmckeb and lots of try/catch... ;-)
@igor-dv what's the implication of this change? is it a breaking change? |
BTW, there is a side effect of the monorepo, where an official react example is also recognized as using |
Looks like |
@igor-dv thoughts on this being a CRA2 preset specifically? |
It's a CRA2 specifically, there is a check of the concrete version |
How can I test that feature and give feedback? I have CRA2 with dynamic imports (react-loadable) and I needed to create my own .babelrc due to the required |
It was released with https://github.com/storybooks/storybook/releases/tag/v4.1.0-alpha.8 |
Thanks, I needed to delete |
@igor-dv @wiesson - This should have been available from this release: https://github.com/storybooks/storybook/releases/tag/v4.1.0-alpha.7 - as this is the point where using the CRA2 defaults for CRA2 apps was introduced. Or is it missing something? The new alpha handles this for React apps not based on CRA. Unless I'm missing something? |
alpha 7 brought your TS support for CRA apps |
I have added stories for svgr and dynamic imports. They are tested in smoke tests / storyshots. In machine it was working with fallback. But in ci it seems working. I don't want to spend time there for now, so for me this is ok.. |
Issues:
#4298 = storybook-eol/addon-smart-knobs#33
#4741
What I did
Since CRA's babel configuration is wider than ours, we can use it for the react setup by default, no matter whether the react app is using CRA or not#4836 (comment)#4836 (comment)