graphprotocol / graph-client

The Graph library for building GraphQL-based dapps in a decentralized way.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SyntaxError: Named export 'ApolloLink' not found. The requested module '@apollo/client' is a CommonJS module, which may not support all module.exports as named exports.

schmidsi opened this issue · comments

Running into this error while trying to load Graph Client with Apollo and Next.js.

Relevant code might be here: https://github.com/schmidsi/hackathon-starterkit/blob/main/frontend/lib/apolloClient.js

I think it is an issue with Apollo Client.
apollographql/apollo-feature-requests#287
However we can convert named imports to default or * as but this would break treeshaking.

Thanks for investigating. For my current purpose of building a tech demo/starterkit for the full Graph stack, tree shaking is not a hard requirement. Not sure about other users though?

If there is a fix that we can implement now and remove after Apollo Client fixed it on their side, I think this would be the way to go. Happy to implement a hack in my repo like resolutions or transpileModules but I don't think that this will work in that situation? I'm not an expert with this whole transpiling, importing thing.

I use Urql for now. Worked great so far.

@ardatan Would it make sense to leave this issue open as the problem with ApolloLink persists? Other people might run into the same problem.