Apollo-client: How can I use Apollo Client 3 without having React as a dependency?

Created on 28 Apr 2020  路  1Comment  路  Source: apollographql/apollo-client

I'd like to use Apollo Client 3 in my Svelte project. When migrating over from 2.6, I noticed I needed react as a dependency to run my project.

ERROR in ./node_modules/@apollo/client/react/react.js
Module not found: Error: Can't resolve 'react' in '/Users/kierangilliam/Documents/git/project/client/node_modules/@apollo/client/react'
 @ ./node_modules/@apollo/client/react/react.js 3:29-45
 @ ./node_modules/@apollo/client/react/hooks/useMutation.js
 @ ./node_modules/@apollo/client/index.js
 @ ./src-ui/lib/user.ts
 @ ./src-ui/views/Setup.svelte
 @ ./src-ui/Index.svelte
 @ ./src-ui/index.js
 @ multi ./src-ui/index.js

Is there a way around this without adding react as a dependency?

Most helpful comment

@kierangilliam Use @apollo/client/core instead of @apollo/client.

>All comments

@kierangilliam Use @apollo/client/core instead of @apollo/client.

Was this page helpful?
0 / 5 - 0 ratings