-
-
Notifications
You must be signed in to change notification settings - Fork 529
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
2.4.0 Main entry point still exports handlers (i.e: GraphQLHandler
)
#2247
Comments
GraphQLHandler
)GraphQLHandler
)
Unfortunately, using more specific exports doesn't always seem to be possible. For example, unless I am mistaken, Similarly, If |
@ghost91- or |
@ghost91-, good point. The explicit import would be better once we drop For now, I think the safest way to fix this and now force developers to install graphql is to make that import dynamic. Need to give this a try. |
I will close this one in favor of #2248 (has a more searchable error message). Please keep track of the updates there. Thanks. |
Released: v2.4.1 🎉This has been released in v2.4.1! Make sure to always update to the latest version ( Predictable release automation by @ossjs/release. |
Prerequisites
Environment check
msw
versionNode.js version
20.14.0
Reproduction repository
https://github.com/nartc/msw-entry-point-bug
Reproduction steps
npm install
npm test
Script fails with
Cannot find module "graphql"
Current behavior
Thank you for your effort on
msw
.Before I say anything, I believe our issue is our own "user error". However, I also believe this issue can still be an overlook as current code would break at runtime with 2.4.0 and the release note does not mention anything about the new secondary entry points available in 2.4.0
This works in pre 2.4.0 but will break in 2.4.0 for projects that don't have
graphql
installed. This is due tomsw
core entry point still exports the handlers which makesgraphql
NOT an optional peer dependency.The proper fix would be to import from
msw/core/http
but it seems likemsw/core/http
does not exportHttpHandler
either.Once again, our project runs into this due to many errors/mistakes on our part but I want to raise this issue in case others run into the same thing (or have the same user errors/mistakes)
Expected behavior
This import should at least break at compilation time (type checking time) with something like: msw does not export
http
. And release note should mention migrating tomsw/core/http
(or respective entry point for the handlers).The text was updated successfully, but these errors were encountered: