mswjs / msw

Industry standard API mocking for JavaScript.
https://mswjs.io
MIT License
15.97k stars 519 forks source link

fix: revert "graphql" as optional peer dependency #2267

Closed kettanaito closed 2 months ago

kettanaito commented 2 months ago

Motivation

ESM imports of optional peer dependencies are virtually impossible. You have to opt-out from your bundler treating them as code splitting points because the dependency may not exist, and then as a result, you become in charge of serving that dependency over HTTP + providing an importmap for the browser to understand where to look it up.

This is an insane ask from a developer, and I'm not willing to make it. I was prematurely optimistic about the state of optional peer dependencies, causing the recent release to be a failure. Lessons learned.

Resolving the original issue

The original issue reported in #2185 states that the graphql dependency has to be a peer dependency to prevent duplicate GraphQL versions installed in a single app (MSW installs v16.1, your app has v16.8, and that potentially causes issues).

kettanaito commented 2 months ago

Released: v2.4.3 🎉

This has been released in v2.4.3!

Make sure to always update to the latest version (npm i msw@latest) to get the newest features and bug fixes.


Predictable release automation by @ossjs/release.