Skip to content
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

apollo-composable "import not found: DefaultApolloClient" #1029

Open
longfellowone opened this issue Aug 4, 2020 · 5 comments
Open

apollo-composable "import not found: DefaultApolloClient" #1029

longfellowone opened this issue Aug 4, 2020 · 5 comments
Labels
v4

Comments

@longfellowone
Copy link

@longfellowone longfellowone commented Aug 4, 2020

Describe the bug
App does not load "import not found: DefaultApolloClient"

To Reproduce

  1. git clone https://github.com/longfellowone/todo-vue.git
  2. npm run dev

Expected behavior
No error

Versions
vue: 3.0.0-rc.5
apollo-composable: 4.0.0-alpha.10
apollo-boost: 0.4.9

Additional context
No other imports working from apollo-composable (useQuery etc.)

@pepsighan
Copy link

@pepsighan pepsighan commented Aug 6, 2020

I think the problem is with vite. I am using a similar setup and its not working.

image

@justinwaite
Copy link

@justinwaite justinwaite commented Aug 6, 2020

Seeing this as well. As a temporary workaround, you can import the default export like so:

import apollo from '@vue/apollo-composable` 

and then use the other exports from there:

  app.provide(apollo.DefaultApolloClient, apolloClient)

Edit:
That being said, I can't get 4.0.0-alpha.10 to work with Vue 3. I end up with an error when trying to query:

Uncaught (in promise) TypeError: Cannot read property '_apolloAppTracking' of undefined

So good luck, let me know if you get it working.

@pepsighan
Copy link

@pepsighan pepsighan commented Aug 7, 2020

@justinwaite I tried the same thing but encountered the same error.

@lzurbriggen
Copy link

@lzurbriggen lzurbriggen commented Aug 10, 2020

@pepsighan Yes, this seems to be an Issue with either vite or the packaging of the library. The imports work fine in a webpack project.

@justinwaite There are 2 changes I had to make to get queries working, the first one is the error you mentioned:

  1. may be an issue with either vue-demi or more likely an API change in a newer version of the composition-api. Issue is this line: const root: any = getCurrentInstance().$root. I temporarily fixed this by replacing $root with root.
  2. the second issue occurs on this line on onServerPrefetch. Temporarily fixed by removing the whole function call (I don't use SSR)

I believe this is related to #1011

@longfellowone
Copy link
Author

@longfellowone longfellowone commented Sep 6, 2020

@justinwaite
@pepsighan
@lzurbriggen

If looking for a fix to

Uncaught (in promise) TypeError: Cannot read property '_apolloAppTracking' of undefined

See #1011 (comment)

@Akryum Akryum added the v4 label Oct 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.