Attempted Import errors when migrating to Apollo 3.x
See original GitHub issueIntended outcome: Migrating from @apollo/react-hooks and other packages to @apollo/client (3.4.7). After following migration guide, my intent was for things to work.
Actual outcome: Followed the migration guide. Have graphql 14.7.0 included in my package node_modules is populated as expected.
When running the dev server, I see the following:
project: ./node_modules/@apollo/client/core/LocalState.js
project: Attempted import error: 'BREAK' is not exported from 'graphql'.
project: ./node_modules/@apollo/client/utilities/globals/graphql.js
project: Attempted import error: 'isType' is not exported from 'graphql'.
project: ./node_modules/graphql-tag/lib/index.js
project: Attempted import error: 'parse' is not exported from 'graphql'.
project: ./node_modules/@apollo/client/link/http/selectHttpOptionsAndBody.js
project: Attempted import error: 'print' is not exported from 'graphql'.
project: ./node_modules/@apollo/client/link/http/createHttpLink.js
project: Attempted import error: 'visit' is not exported from 'graphql'.
project: ./node_modules/@apollo/client/utilities/graphql/transform.js
project: Attempted import error: 'visit' is not exported from 'graphql'.
project: ./node_modules/@apollo/client/utilities/graphql/transform.js
project: Attempted import error: 'visit' is not exported from 'graphql'.
project: ./node_modules/@apollo/client/utilities/graphql/transform.js
project: Attempted import error: 'visit' is not exported from 'graphql'.
project: ./node_modules/@apollo/client/utilities/graphql/transform.js
project: Attempted import error: 'visit' is not exported from 'graphql'.
project: ./node_modules/@apollo/client/utilities/graphql/transform.js
project: Attempted import error: 'visit' is not exported from 'graphql'.
project: ./node_modules/@apollo/client/utilities/graphql/transform.js
project: Attempted import error: 'visit' is not exported from 'graphql'.
project: ./node_modules/@apollo/client/utilities/graphql/directives.js
project: Attempted import error: 'visit' is not exported from 'graphql'.
project: ./node_modules/@apollo/client/core/LocalState.js
project: Attempted import error: 'visit' is not exported from 'graphql'.
project: Search for the keywords to learn more about each warning.
project: To ignore, add // eslint-disable-next-line to the line before.
When inspecting my local node_modules, I see that visit
and BREAK
are exported by the graphql
package.
How to reproduce the issue:
Versions 3.4.7 and attempted 3.3.20
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Attempted Import errors when migrating to Apollo 3.4 - Help
js project: Attempted import error: 'visit' is not exported from 'graphql'. project: ./node_modules/@apollo/client/utilities/graphql/transform.
Read more >Apollo-Client - Error: Could not identify object - Stack Overflow
what Im trying to achieve is updating the cached files with the new file, and re-render the component that contain the FilesQuery hook....
Read more >@apollo/client | Yarn - Package Manager
Apollo Client is a fully-featured caching GraphQL client with integrations for React, Angular, and more. It allows you to easily build UI components...
Read more >Pitfalls I fell into during Apollo Client 3.0 migration
import issue with `graphql-tag`. When I ran unit tests(jest) it stopped with an error message saying TypeError:(0, _client.gql) is not a function ......
Read more >Automatically handling Apollo Client errors in your React UI
import { onError } from "@apollo/client/link/error" ; ... Let's start by moving the logic that creates the ApolloClient instance and renders ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
For those who come here later having this issue I’m using absolute path imports and I had a folder in
src/
calledgraphql
which made the entire confusion around the typing for the TS… renaming the folder made everything work as expectedYou can set
traceResolution: true
in your tsconfig.json to better display the error 😃@benjamn many people are stuck on graphql v14 because the apollo cli isn’t compatible with v15: https://github.com/apollographql/apollo-tooling/issues/2232