Skip to content
This repository has been archived by the owner on Dec 30, 2021. It is now read-only.

snowpack react project does not work with @apollo/client #87

Closed
canercandan opened this issue May 28, 2020 · 4 comments
Closed

snowpack react project does not work with @apollo/client #87

canercandan opened this issue May 28, 2020 · 4 comments

Comments

@canercandan
Copy link

Hi,

I need to use the Apollo React client in my project and using Snowpack it does not seem to work because @apollo/client uses a "require()" instruction somewhere in its bundle, is there any documented workaround for those kind of setup, also according to pika @apollo/client seems to be fine in terms of exposing a module endpoint.

Thanks

@FredKSchott
Copy link
Owner

I can't reproduce, this works fine for me:

// first, npm install "@apollo/client" & "graphql@^14"

// src/index.js
import * as ap from '@apollo/client';
console.log(ap);

@canercandan
Copy link
Author

Thanks @FredKSchott for getting back to me that quick,

the issue actually occurs when using "ApolloProvider" from "@apollo/client" as such:

import {
  ApolloClient,
  ApolloProvider,
} from "@apollo/client"

and using it later:

const client = new ApolloClient(...)

render(
  <React.StrictMode>
    <ApolloProvider client={client}>
      <div>Dummy text</div>
    </ApolloProvider>
  </React.StrictMode>,
  document.getElementById("root")
)

thanks

@FredKSchott
Copy link
Owner

Thanks! I can reproduce. This is an issue in Apollo's v3 beta version, unfortunately. I filed an issue here: apollographql/apollo-client#6352 (looks like it's been reported before though). Hopefully they fix before v3.0.0.

Until then, you'll want to use their non-beta via v2 release. pika.dev is currently build with Snowpack and Apollo and is using this branch, and it works great.

@FredKSchott
Copy link
Owner

The Apollo team fixed the issue, the package should now work as of @apollo/client@3.0.0-beta.53

apollographql/apollo-client#6352

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants