kamilkisiela / apollo-angular

A fully-featured, production ready caching GraphQL client for Angular and every GraphQL server 🎁
https://apollo-angular.com
MIT License
1.5k stars 309 forks source link

Reactive variables seem to rely on react #1763

Closed gerhardavon closed 2 years ago

gerhardavon commented 2 years ago

When applying the most basic example of reactive forms. I get an error in the compiler that it relies on react.

Read following part of the documentation

https://apollo-angular.com/docs/local-state/reactive-variables refers to https://www.apollographql.com/docs/react/local-state/reactive-variables/

When applying the most basic example of reactive variables i get an error while compiling:

import { makeVar } from '@apollo/client';

const cartItemsVar = makeVar([]);

./node_modules/@apollo/client/react/context/ApolloConsumer.js:2:0-31 - Error: Module not found: Error: Can't resolve 'react' in '/home/gerhard/Workspace/creditcare-backoffice/node_modules/@apollo/client/react/context'

I would expect the variable to be an empty array.

├── @angular/cli@12.2.15 ├── @angular/core@12.2.15 ├── @apollo/client@3.5.9 ├── apollo-angular@3.0.0 ├── graphql@15.8.0 └── typescript@4.3.5

kamilkisiela commented 2 years ago

It's an issue with @apollo/client not apollo-angular so please open an issue there.

kamilkisiela commented 2 years ago

Plus as stated in the documentation multiple times, you want to always use sub-packages of @apollo/client/* and not @apollo/client directly.