graphql-tools
graphql-tools copied to clipboard
ApolloLink import error when using Apollo Client V3.
Issue workflow progress
Progress of the issue based on the Contributor Workflow
- [ ] 1. The issue provides a reproduction available on Github, Stackblitz or CodeSandbox
Make sure to fork this template and run
yarn generatein the terminal.Please make sure the GraphQL Tools package versions under
package.jsonmatches yours. - [ ] 2. A failing test has been provided
- [ ] 3. A local solution has been provided
- [ ] 4. A pull request is pending review
Describe the bug
I upgraded to Apollo V3 and also updated all @graphql-tools/* packages to the latest version.
When trying to use linkToExecutor I'm getting the following error:
./node_modules/@graphql-tools/links/index.mjs
Attempted import error: 'ApolloLink' is not exported from '@apollo/client/link/core'.
I manually changed the import in the package to use '@apollo/client' but it didn't solve the problem.
Does anyone successfully use @graphql-tools/links with @apollo/client^3.5.10?
Environment:
- OS: macOS 12.2.1 (21D62)
@graphql-tools/links: ^8.2.9- NodeJS: v14.17.6
@apollo/client: ^3.5.10
I think it is lack of ESM support on Apollo Client side. Please try to use CJS instead. If still doesn't work, please create a reproduction on CodeSandbox or StackBlitz. Thanks!
I'm not quite sure about this. Everywhere else I also use ESM syntax for apollo client imports and it works just fine. But I will try it out with CJS imports in the @graphql-tools/links package.
@roydigerhund I've updated your initial comment with the Issue workflow progress, do you think you could help us tackle the first phase of progress? Thanks!
Which template should I fork here?
Make sure to fork this template and run yarn generate in the terminal.
This is fixed in v8.3.0 with https://github.com/ardatan/graphql-tools/commit/d76a299cf9ccc3e8b3bc6f36bcb1c32bb61d39f1