question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[v3] React dependency is hard coded

See original GitHub issue

Hi, 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:closed
  • Created 4 years ago
  • Reactions:13
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
kamilkisielacommented, Nov 2, 2019

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…

1reaction
abdonrdcommented, Nov 2, 2019

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.

Screenshot 2019-11-02 at 11 08 13

And now working just patching @apollo/client@beta to remove the React exports.

Screenshot 2019-11-02 at 11 11 39

Note: The Apollo Client implementation is really simple and hardcoded to make the example easier.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Remove hard dependency on npm 3.x.x · Issue #51 - GitHub
When trying to use a recent version of npm the install fails with: > npm install npm ERR! code EBADENGINE npm ERR! engine...
Read more >
React js with sub dependency of core-js v3.20.0 breaks page ...
Fix: Downgrading core-js sub dependency from 3.20.0 to 3.7.0 fixes the page and removes the error message o.next is not a function. To...
Read more >
Vite 3.0 vs. Create React App: Comparison and migration guide
Learn how to build React applications with Vite and how to migrate from Create React App to Vite. Compare the core concepts of...
Read more >
How to Remove Unused Dependencies in React - Pluralsight
Using npm-check to Track Dependencies​​ Install it globally first by running the following command. Following on the previous section, import the ...
Read more >
Removing Effect Dependencies - React Docs
Dependencies should match the code. When you write an Effect, ... Console (3) ... Your Effect's dependency list is determined by the surrounding...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found