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

No support for grapql 16.x / Apollo Client 3.x #1448

Open
floppey opened this issue Jan 17, 2023 · 3 comments
Open

No support for grapql 16.x / Apollo Client 3.x #1448

floppey opened this issue Jan 17, 2023 · 3 comments

Comments

@floppey
Copy link

floppey commented Jan 17, 2023

Describe the bug
I'm trying to update our dependencies to use the latest version of graphql and apollo client, but I can't find a way to do this with vue-apollo.

Currently if I update graphql to the latest version, or any 16.x version I get an error because apollo-boost requires version 15.x

npm ERR! Conflicting peer dependency: graphql@15.8.0
npm ERR! node_modules/graphql
npm ERR!   peer graphql@"^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0" from apollo-boost@0.4.9
npm ERR!   node_modules/apollo-boost
npm ERR!     apollo-boost@"^0.4.9" from the root project

According to apollo's documentation apollo-boost should not be used with the latest version of @apollo/client.

As far as I can tell the current version of vue-apollo (3.1.0) is fairly outdated and does not support the latest version of @apollo/client. I did find what looks like a new version of vue-apollo, but now called @vue/apollo-composable. The documentation here is very lacking and after installing it and using the new package my project crashes due to a missing React dependency.

Installation instructions from https://v4.apollo.vuejs.org/guide/installation.html :

npm install --save graphql graphql-tag @apollo/client

Error when installing:

npm ERR! Conflicting peer dependency: react@18.2.0
npm ERR! node_modules/react
npm ERR!   peer react@"^18.2.0" from react-dom@18.2.0
npm ERR!   node_modules/react-dom
npm ERR!     peerOptional react-dom@"^16.8.0 || ^17.0.0 || ^18.0.0" from @apollo/client@3.7.4
npm ERR!     node_modules/@apollo/client
npm ERR!       @apollo/client@"*" from the root project

After installing with --legacy-peer-deps flag and trying to use ApolloClient from @apollo/client:

import { ApolloClient } from "@apollo/client";

I then get this error when I run the application:

X [ERROR] Could not resolve "react"

    node_modules/@apollo/client/react/context/ApolloContext.js:1:23:
      1 │ import * as React from 'react';

Expected behavior
I'd like to be able to use an up to date version of ApolloClient in my vue application.

Versions
vue: 3.2.37
vue-apollo: 3.1.0
@apollo/client: 3.7.4
@vue/apollo-composable: 4.0.0-beta.1

@dominikklein
Copy link
Contributor

dominikklein commented Jan 26, 2023

Normally it should be working fine, in our project we have no problems with the current GraphQL and Apollo-Client version.

I think the problem is that you need to use the "core" package directly after the update of the Apollo-Client 3:

import { ApolloClient } from '@apollo/client/core'

When you use the imports from @apollo/client the "react" dependency hooks in.

https://www.apollographql.com/docs/react/migrating/apollo-client-3-migration/#using-apollo-client-without-react

@websitevirtuoso
Copy link
Contributor

yes/ I also don't have nay issue I am using latest versions of packages.
vite, vue 3.3, gql 3.
Apoolo v3 has some limitations in their TS when use imports. you can find related issues on their repo. It will be fixed in apollo package v4

@riodw
Copy link

riodw commented Jun 28, 2023

This is the error I am getting:

[vite] error while updating dependencies:
Error: ENOENT: no such file or directory, open './node_modules/apollo-boost/lib/bundle.esm.js'

Edit:
Fixed by running yarn add apollo-boost

  1. https://v4.apollo.vuejs.org/guide/installation.html
  2. https://v4.apollo.vuejs.org/guide-composable/setup.html
    Nothing in the docs ^ lists this as a dependency.

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

4 participants