-
-
Notifications
You must be signed in to change notification settings - Fork 523
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
Vue3 Vue Apollo composable throws error #1217
Comments
Fixed with downgrading Anyway before I close case it's only way to use apollo in both ways? //// apollo provider
import {
ApolloClient,
InMemoryCache,
HttpLink,
} from "@apollo/client/core"
import { createApolloProvider } from "@vue/apollo-option"
//...
const apolloClient = new ApolloClient({
link,
cache: new InMemoryCache(),
})
const apolloProvider = createApolloProvider({
defaultClient: apolloClient,
})
export { apolloProvider, apolloClient }
//// main.ts
//...
import { apolloClient, apolloProvider } from "./configuration/apollo"
//..
const app = createApp({
setup() {
provide(DefaultApolloClient, apolloClient)
},
render: (h) => h(App),
})
app.use(apolloProvider)
app.mount("#app") I mean queries in component load with Options API and use Composition API |
I am currently using @vue/apollo-composable ^4.0.0-alpha.12 and have the same error. P.S I am using Vue 2 with composition API |
I also got this after upgrading 4.0.0-alpha.12 to 4.0.0-alpha.13. Downgrading again fixed it. (Also using it with Vue 2 composition api) |
I'm on Vue 3, I had |
const resolvedClient = providedApolloClients ? providedApolloClients.default : providedApolloClient ?? void 0; This is valid JS. Maybe update your tooling such as babel parser? |
Yeah, I am also freezing a version to |
I did try it on a fresh install from vue ui as on the current project I'm upgrading to vue3. Both same error. |
I don't have this issue here |
I did brew upgrade, yarn upgrade, still same error. Idk. maybe its due apple m1 chip |
In my case, it was indeed a babel configuration issue. The nullish coalescing operator is not supported by webpack 4, so the @vue/apollo-composable module needs to be transpiled with babel before it is loaded. For Nuxt, you simply add |
My link above is using webpack 4 without issue. Note that |
Where is the original error coming from? The babel parser? An internal webpack file? Is the stack trace in full here? |
@Akryum I am using Yeah, it's a full stack trace. It's an error from the bitbucket pipeline.
|
Seems like acorn is the culprit, webpack 4 is using acorn 6 and nullish coalescing operator support was added in acorn 7 |
Will probably lower the esbuild target to what acorn 6 understands. |
In the meantime, another possible workaround is upgrading to Webpack 5. |
another fix from me - I am migration vue2 app to vue3 that was running made with vue cli, |
I have this error and none of the fixes here have helped me. Except for me the error only occurs when inside a docker container Dockerfile
|
Nevermind, I got my issue figured out. For some reason it didn't like me installing the npm packages before copying my app files in. Dockerfile Updated
|
FIX (working to me at least)
downgrade
"@vue/apollo-composable": "^4.0.0-alpha.13"
to"@vue/apollo-composable": "^4.0.0-alpha.12"
Describe the bug
Calling anything from
"@vue/apollo-composable"
throws errorTo Reproduce
console log are simplest repdoruction, but any useQuery or other doesn't work
Versions
The text was updated successfully, but these errors were encountered: