-
Notifications
You must be signed in to change notification settings - Fork 9.1k
react as peerDependency #3934
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
Comments
Hi @janusch! Thanks for the report. Unfortunately, we aren't able to move Swagger-UI is commonly used in non-React contexts. As an example, here's Swagger-UI inside of an Angular 4 app: https://github.com/shockey/swagger-ui-angular4/blob/master/package.json#L26 You do raise a valid point w/r/t React 16. Perhaps we could declare React as a dependency and a peer dependency, so that downstream react 16 modules satisfy one of the requirements,, but I can't find any npm documentation for this use case. I'll look into this some more and circle back to this thread. |
Hi @shockey, In my case, i think ill pull out swagger-ui of the project and use it in a separate. Thank you for looking into this! |
Haven't done a ton of npm package publishing but wondering if it's possible to create two packages for this? Leave the existing one as it is that includes React as dependency but then include another one that has it as a peer? Seems weird but would solve a problem that anyone using React is going to have at one point or another and troubleshooting it can be very confusing. For right now is the recommended approach to fork this, move React to peerDep and then use our fork as the package name in our package.json? |
Yeah, this is possible - we're already doing that with |
Fixed! We've just released |
Expected Behavior
declare dep to react as peerDependency not as dependency
Current Behavior
bug if app is using different version of react.
Possible Solution
facebook/react#8026 (comment)
Context
it sneaked in through updating swagger-ui
Would be great if you would not mind changing this.
Thank you for your great work on swagger!
The text was updated successfully, but these errors were encountered: