From e10cdcf419e5fb1e50e6caca77fd5bf96c3c5b0f Mon Sep 17 00:00:00 2001 From: Jamie Warburton Date: Mon, 20 Dec 2021 11:15:35 +0000 Subject: [PATCH] fix(nuxt-bridge): add support for nuxt bridge Nuxt Bridge exposes the Nuxt 2 context via nuxtApp.nuxt2Context. However, when doing `app.apolloProvider`, the apolloProvider is not added to this context. In order to get the apolloProvider onto this nuxt2Context, we must use inject(). However, it requires a different name than "apolloProvider" when injecting, or we get errors. --- lib/templates/plugin.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/templates/plugin.js b/lib/templates/plugin.js index 17a39d8..221892f 100644 --- a/lib/templates/plugin.js +++ b/lib/templates/plugin.js @@ -113,6 +113,7 @@ export default (ctx, inject) => { const apolloProvider = new VueApollo(vueApolloOptions) // Allow access to the provider in the context app.apolloProvider = apolloProvider + inject('theApolloProvider', apolloProvider); if (process.server) { const ApolloSSR = require('vue-apollo/ssr')