-
-
Notifications
You must be signed in to change notification settings - Fork 525
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
List "graphql" as a peer dependency #2185
Comments
This error was a red herring 🙃 It's actually coming from The fact that MSW lists graphql as a dependency was unexpected, though; it would be easier to rule it out as a source of potential conflicts if it treated it as a peer dependency, so I'll leave this open for now. |
Hi, @alessbell. Thanks for proposing this. I agree it makes sense to list One potential problem here is that |
I've opened a pull request with the proposed change: #2187. @alessbell, please, could you give it a try in your project? You can add a dependency from a pull request/branch using all modern package managers. If you have any problems, please let me know. Code reviews are welcome too! |
Released: v2.4.0 🎉This has been released in v2.4.0! Make sure to always update to the latest version ( Predictable release automation by @ossjs/release. |
My attempt at listing graphql as an optional peer dependency was unsuccessful. There isn't really a concept of an optional peer dependency in ESM (see #2267 for more details). As the next step, I will try installing graphql as a regular dependency with MSW while also listing it as an optional peer dependency. That should provide both the fallback for teams not using GraphQL, as well as take the project's graphql version as a priority during the module resolution. At least, I hope it will. |
Prerequisites
Environment check
msw
versionBrowsers
No response
Reproduction repository
https://github.com/apollographql/graphql-testing-library
Reproduction steps
When installing
msw
,graphql
is installed as a transitive dependency at v16. This goes against the expectation in the GraphQL ecosystem thatgraphql
always be treated as a peer dependency: graphql/graphql-js#594 (comment)From the
graphql
source:This cannot be trivially overridden with all package managers (e.g. npm overrides has open issues), and causes surprising behavior.
Current behavior
graphql
is a dependency of MSW.Here's an example of a project using a number of packages that rely on
graphql
. All of them list it as a peer dependency with the range of 15 || 16, except for MSW.The result is my MSW GraphQL handler returning errors about unsupported GraphQL features for a version of GraphQL I haven't installed and don't expect to be executing my queries:
Expected behavior
I'd expect MSW to treat it as a peer dependency.
The text was updated successfully, but these errors were encountered: