-
-
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
Why does @storybook/addon-docs have babel-loader as a peer dependency? #13183
Comments
Addon docs uses babel-loader AFAIK. So it should either be a dependency or a peer dependency. We might be able to loosen up the version specifier? Or do you have another proposal? |
Given that any user of this addon will obviously have Storybook installed, they'll already have babel-loader:
I'm not sure what's gained by the peer dependency. Keeping my babel-loader dependency in sync with whatever is being shipped with Storybook seems like unnecessary and time-consuming maintenance. Isn't it better to avoid the potential of version mismatches in the tree of dependencies? |
FYI react-scripts package expects a specific version of babel-loader and will fail to run if installed version is not what it wants.
|
I'm getting the same error with Using a different version will always lead to the above error. |
I see that a similar problem applies to webpack, the difference is that webpack is only peer dependency so you end up with a warning rather than a build failure:
|
I noticed that #4764 has been closed. Not sure if this was supposed to solve this issue? |
@elie222 meaning you installed a fresh copy of storybook on a CRA with 6.1.5 and you're seeing the issue? |
Not a fresh copy. Using react-scripts 4.0.1 and Storybook 6.1.5 but upgrading an existing project: |
@elie222 The fix here was NOT to install babel stuff at all if we're installing into a CRA app and to directly use the CRA setup instead. So it only applies to new storybook installs generated by the CLI. FWIW I'm not confident about the fix, but this issue seemed like it was breaking a bunch of people and it is worth a try. It doesn't seem like there's a good solution for existing apps, other than perhaps to delete the dependencies by hand and reinstall. Can you try that? |
Still no luck. The output we're getting when running
|
I've experienced just the same issue with a fresh install of Storybook in a Create-React-App. "resolutions": {
"babel-loader": "8.1.0"
}, This doesn't solve it for NPM yet. |
The above doesn't work for me, even though I am using yarn. Has any progress been made on this issue? |
Ah nvm, you need to follow with https://classic.yarnpkg.com/en/docs/selective-version-resolutions/#toc-how-to-use-it |
I'm seeing this issue with npm when upgrading from react-scripts v3 to v4. |
Storybook docs now uses the babel-loader provided by storybook core, so I think this is resolved at some level. I'm not sure what to do with the peer dependency tho.. @merceyz @gaetanmaisse thoughts? |
I think we can clean everything on the |
Yeah, makes sense to clean that up, should include |
Ok, I will do it later today, thanks a lot for the feedback @merceyz :) |
Is there a solution for npm for this just experienced this with my project? |
Still seeing this issue too, all with latest versions |
bump :) |
Yay!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.3.0-alpha.14 containing PR #14689 that references this issue. Upgrade today to the
Closing this issue. Please re-open if you think there's still more to do. |
thank you @shilman! |
@NTag Please elaborate as that output looks fine |
|
That's not an issue with Storybook, see #14811 (comment). Disable the preflight check and it should work |
Ok, that makes sense 👍 . Thanks! |
So, is the "right" solution to disable the preflight check? :) |
yes @Nautman |
Is this problem going to be solved on CRA side? Does anyone know? |
I've heard from a CRA team member that they are planning to relax that check in CRA, but I don't know whether that's still happening since I heard it awhile ago. |
storybook has a conflict with cra due to versioning issues on babel loader and a faulty check on the cra side (see: storybookjs/storybook#13183 and facebook/create-react-app#10123 (comment)). this required either some hackery on the command side (by disabling preflight checks) or upgrading react-scripts to 5.0. as react scripts is not a direct dependency at runtime when serving our application, i opted for this approach. another issue that cropped up was postcss requiring version 8 due to transistive dependencies (design system -> chakra -> tailwind -> postcss). this was fixed by installing a direct dependency on postcss @ 8, which was the approach mentioned here: postcss/postcss-import#435. A dev mentioned that the API between 7/8 did not differ much and the release notes for 8 (https://github.com/postcss/postcss/wiki/PostCSS-8-for-end-users) also mentioned that there are no significant differences for end users, so this should be safe. tl;dr: build issues are fixed by upgrading dependencies. if you ever read this message, or any of the previous long commit messages, please drop me a :ultrafastparrot: thx
Describe the bug
When I install packages, I get this warning:
Why should I add babel-loader as a dependency when it already comes with Storybook? Doing so is kind of dangerous because it runs the risk of having mismatched versions in the dependency tree. It seems like this peer dependency is not needed.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
No warnings.
System
The text was updated successfully, but these errors were encountered: