apollo: export 'onServerPrefetch' was not found in 'vue-demi'

Describe the bug @vue/apollo-composable doesn’t work with vue 3 since vue-demi cant resolve onServerPrefetch. Seems it’s only provided by @vue/composition-api

To Reproduce Steps to reproduce the behavior:

  1. Create a new vue 3 project
  2. Install graphql graphql-tag @apollo/client as described here
  3. Install and configure @vue/apollo-composable as described here
  4. See warning in terminal:
 warning  in ./node_modules/@vue/apollo-composable/dist/useQuery.js

"export 'onServerPrefetch' was not found in 'vue-demi'

Expected behavior One should be able to import onServerPrefetch from @vue/apollo-composable (or directly from vue?)

Versions vue: 3.0.2 @vue/apollo-composable: 4.0.0-apha.12 @apollo/client: 3.2.7

Additional context Trying to import onServerPrefetch from @vue/composition-api leads to another warning on the terminal:

 warning  in ./node_modules/@vue/composition-api/dist/vue-composition-api.esm.js

"export 'default' (imported as 'Vue') was not found in 'vue'

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 109
  • Comments: 35

Commits related to this issue

Most upvoted comments

Please stop posting comments saying you have the same issue. You can use the 👍 reaction on the initial post for that. I’m also a user that want to see this fixed but this won’t change anything except pissing off maintainers. Many people are getting notified and that’s just useless noise. Thank you 🙇🏻‍♂️

Any update on this?

Can you please provide an update on this issue?

Anything on this yet?

Any updates anywhere on this issue yet?

Updates please?

have the same issue

Vue 3.1.0 beta is out now with support for onServerPrefetch, see https://github.com/vuejs/vue-next/blob/master/CHANGELOG.md. If you use 3.1 beta, the issue will dissappear.

I have found something interesting that you can use to handle this issue :

  • Use import { provide } from "vue"; instead of import { provide } from "@vue/composition-api"
  • This provide will be used to set your apollo clients: provide(ApolloClients, { default: apolloClient, });

I hope this will resolve your issue.

I’m using import { provide } from "vue"; but it doesn’t help 😦

like this: import { DefaultApolloClient } from '@vue/apollo-composable' import { apolloClient } from '@/apollo-client' import { createApp, provide } from 'vue'

const app = createApp({ setup () { provide(DefaultApolloClient, apolloClient) }, render: () => h(App), })

All you should have to do to fix this issue is to use Vue 3.1+

Same problem in here

same here :<

Same problem here.

Same issue.