-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Apollo client requires react ?!? #8958
Comments
This is something we’re trying to fix, but will have to wait til a major version release, as it would be a breaking change. For now, you will have to continue importing the client from the |
This could be an interesting consideration for AC 4.0, So i'll add it to our milestone for consideration. Cc @bignimbus |
Just ran into this while trying to use Apollo with Solid. |
Same here when using Apollo with Svelte. |
It is very annoying to have a peerDependency to React. Importing from |
@andreasonny83 |
@phryneas that is true, however the |
@andreasonny83 npm v7 shipped with node 15, which went End of Life 2 years ago. Node 16 (the oldest officially supported node version, which will receive support for one more month at this point) already ships with npm v8.
I'm sorry, but that decision predates me. |
Hi guys!
Thank you for the great project it opens up many possibilities using graphql!
I am an early bird user from the moment that apollo introduced apollo-client!
I have created a package called
@rxdi/graphql-client
which helps me to wrap all of the `apollo-client logic and initialize it inside a dependency injection called @rxdi.So far so good but i decided to upgrade
apollo-client
to a new3.*.*
version using@apollo/client
package and i got a bundle error that saysCannot resolve dependency 'react'
So i have investigated a little bit and i found out that inside the barrel export 'index.ts' there is a line
export * from './react';
i was shocked to see this so i follow it up and i found this file https://github.com/apollographql/apollo-client/blob/main/src/react/context/ApolloProvider.tsxframework
which tight couples the@apollo/client
toreact
?@apollo/client
does that sounds right ?@apollo/client
can be called asreact
framework for graphql so i can skip next time when i want to install something which was framework agnostic ?I am not a React user i have my own framework build using Web Components if you want you can check it out using this starter https://github.com/rxdi/starter-client-side-lit-html
By the way this starter is using also
apollo-client
for interacting with Elon Musk Space X APIOne way to mitigate this issue is to try to setup the
@apollo/client
not using the barrel export but instead a specific one by path. I have found that@apollo/client/core
suits me well so wish me luck ! :)Please don't get me wrong i like every framework but i decided to invest time and build my own stack and i am relying to a framework agnostic packages.
Cheers,
Kristiyan Tachev
The text was updated successfully, but these errors were encountered: