-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Avoid all sub-package imports from graphql npm package. #7185
Avoid all sub-package imports from graphql npm package. #7185
Conversation
@stoically: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Apollo Contributor License Agreement here: https://contribute.apollographql.com/ |
Since we don't control the contents of this package, and nested subdirectories within the graphql package do not have their own package.json files with "main" and "module" entry points (like our `@apollo/client/*` sub-packages do), it is unfortunately not safe to reach into the package to import specific items, as demonstrated by apollographql#7184. This could cause a bundle size regression for bundlers that do not perform any tree-shaking, but it's the responsibility of the graphql package maintainers to support selective sub-package imports if they want to. Until that happens, @apollo/client must import from the graphql package in the only supported way: directly from the top-level package.
dcc940e
to
8a334f7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stoically As I wrote in the commit message for 8a334f7, I think we can go even further here:
Since we don't control the contents of the
graphql
package, and nested subdirectories within thegraphql
package do not have their ownpackage.json
files with "main" and "module" entry points (like our@apollo/client/*
sub-packages do), it is unfortunately not safe to reach into the package to import specific items, as demonstrated by #7184.This could cause a bundle size regression for bundlers that do not perform any tree-shaking, but it's the responsibility of the
graphql
package maintainers to support selective sub-package imports, if they want to. Until that happens,@apollo/client
must import from thegraphql
package in the only supported way: directly from the top-level package.
@benjamn @stoically when upgrading
After debugging the issue, I believe e145a86 is the reason for this issue. No problem with |
@AdrienLemaire Might want to open a new issue with something to reproduce as well |
We have the same issues on our prod project - @apollo/client/core/LocalState.js can't get 'BREAK' from 'graphql'. We have "graphql": "^15.4.0", |
@AdrienLemaire @ivanprotasov Please see #7348 (comment), and, if that doesn't help, definitely open a new issue. Thanks! |
I confirm that adding ".mjs" to my webpack |
Looks like one subdirectory import from graphql has been missed:
|
Fixes #7184 (and ardatan/graphql-tools#1790)
Checklist: