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

export 'onServerPrefetch' was not found in 'vue-demi' #1102

Closed
micbra opened this issue Nov 19, 2020 · 35 comments
Closed

export 'onServerPrefetch' was not found in 'vue-demi' #1102

micbra opened this issue Nov 19, 2020 · 35 comments

Comments

@micbra
Copy link

micbra commented Nov 19, 2020

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'
@Skulsta
Copy link

Skulsta commented Nov 27, 2020

Any update on this?

@Gyurmatag
Copy link

Can you please provide an update on this issue?

@vjself
Copy link

vjself commented Dec 1, 2020

Any updates anywhere on this issue yet?

@camwhite
Copy link

Anything on this yet?

@tbarkley
Copy link

Updates please?

@victororlyk
Copy link

have the same issue

killix added a commit to killix/vue-apollo that referenced this issue Jan 12, 2021
@killix
Copy link

killix commented Jan 12, 2021

I am working with this hack for now killix@1dbb4bf

@camwhite
Copy link

I am working with this hack for now killix@1dbb4bf

@killix does this break prefetching?

@killix
Copy link

killix commented Jan 13, 2021

Should not as vue-demi doesn't export the function.

@leonardoks16
Copy link

Same problem here

@tbarkley
Copy link

Very nice work btw but I'm having the same issue, any updates?

@leonardoks16
Copy link

leonardoks16 commented Jan 16, 2021

Check this out, i alread tested with Vue, Vite.js and Node. Astrid-Client

@abdullahseba
Copy link

Same issue.

@ronny1020
Copy link

Same problem here.

@JoJk0
Copy link

JoJk0 commented Feb 9, 2021

same here :<

@simultsop
Copy link

looking forward

@guillaumeduhan
Copy link

Same here ✨

1 similar comment
@sephirothwzc
Copy link

Same here ✨

@georgep11
Copy link

I am having the same issue

@JasonAtallah
Copy link

Any updates on this?

@iamgmd
Copy link

iamgmd commented Mar 12, 2021

Same here

@napalmpapalam
Copy link

same

@alex-bluetrain
Copy link

same thing

@LeBenLeBen
Copy link

LeBenLeBen commented Mar 16, 2021

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 🙇🏻‍♂️

@blay12cedric
Copy link

blay12cedric commented Apr 13, 2021

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.

@napalmpapalam
Copy link

napalmpapalam commented Apr 14, 2021

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),
})

@ant1m4tt3r
Copy link

Same problem in here

@notngan
Copy link

notngan commented May 7, 2021

this solved the problems for me:
quasarframework/app-extension-apollo#51 (comment)

@boboldehampsink
Copy link

boboldehampsink commented May 10, 2021

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.

@cblaettl
Copy link

cblaettl commented May 11, 2021

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.

Thanks for the heads-up, but now I'm getting the following error:

ReferenceError: getCurrentInstance is not defined
    at useQueryImpl (useQuery.ts:140)
    at useQuery (useQuery.ts:127)

I'm currently using vite, but I might switch back to webpack if this solves the issue. Anyone else experiencing the same issue?
My dependencies:

@apollo/client: 3.3.16
@vue/apollo-composable: 4.0.0-alpha.12
vue: 3.1.0-beta.2

Edit: Seems to work fine with Webpack. So I guess I stick to Webpack until this issue in vite is resolved.

@saibbyweb
Copy link

saibbyweb commented May 29, 2021

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.

{ "vue": "^3.1.0-beta.6" }

solves the issue for me (using vite)

@rickyvadala
Copy link

Guys great news!
I got it running, I realized that the documentation on the repo is not complete
https://github.com/quasarframework/app-extension-apollo/tree/v2

Is missing this part:

Your src/App.vue should be like this

<template>
  <router-view />
</template>
<script lang="ts">
  import { defineComponent, provide } from 'vue'
  import { ApolloClients } from '@vue/apollo-composable'
  import { apolloClients } from 'src/extensions/apollo/boot'

  export default defineComponent({
    name: 'App',
    setup() {
      provide(ApolloClients, apolloClients)
    },
  })
</script>

PD: Found this on the README of the library in your-app\node_modules@quasar\quasar-app-extension-apollo\README.md

@jesusgabri3l
Copy link

this solved the problems for me:
quasarframework/app-extension-apollo#51 (comment)
Solved the issue!

@tronghieu60s
Copy link

Guys great news!
I got it running, I realized that the documentation on the repo is not complete
https://github.com/quasarframework/app-extension-apollo/tree/v2

Is missing this part:

Your src/App.vue should be like this

<template>
  <router-view />
</template>
<script lang="ts">
  import { defineComponent, provide } from 'vue'
  import { ApolloClients } from '@vue/apollo-composable'
  import { apolloClients } from 'src/extensions/apollo/boot'

  export default defineComponent({
    name: 'App',
    setup() {
      provide(ApolloClients, apolloClients)
    },
  })
</script>

PD: Found this on the README of the library in your-app\node_modules@quasar\quasar-app-extension-apollo\README.md

It doesn't work for me.

@LeBenLeBen
Copy link

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

@Akryum Akryum closed this as completed Jul 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests