[v3] React dependency is hard coded
See original GitHub issueHi, I’m the author of Apollo Angular and I noticed that @apollo/client
has now an optional dependency of react
.
It’s not a big problem in tools like npm
or yarn
but it breaks every single integration with other frameworks, even vue-apollo
.
Vue and Angular people (or even folks from Svelte, Web Components, Polymer and so on) will see an error at build time that react
module is missing or even at type checking phase when compiling with TypeScript.
I know that Vue, Angular or any framework other than React is not considered when planning new versions and not even listed in docs but we do our best to support our customers working day-to-day with those frameworks, in my case it’s Angular.
I would be happy to help solving that issue.
Splitting core logic into @apollo/core
and putting that in @apollo/client
with react code sounds like a good option to me. Without that, I need to maintain a fork.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:13
- Comments:11 (11 by maintainers)
Top GitHub Comments
An extra thing to think about. Including
react
in@apollo/client
means that whenever someone uses@apollo/client
directly, in any 3rd-party library then all non-react codebases are broken.Would be so easier if there would be
@apollo/react
(which sounds even better then@apollo/client
) that includes everything + react related code and@apollo/client
that is a base for@apollo/react
and other integrations.I don’t mind you guys focusing only on React, this is your target, of course but at least don’t break other UI integrations. We do it for free (for over 3 years by now) and spend tons of time because of those changes…
An example of the
npm init @open-wc
application with@apollo/client@beta
. Thanks to ES Modules, this application runs directly in the browser, without any build/bundle step.And now working just patching
@apollo/client@beta
to remove the React exports.Note: The Apollo Client implementation is really simple and hardcoded to make the example easier.