Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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. #297

Closed
schmidsi opened this issue Oct 22, 2022 · 5 comments

Comments

@schmidsi
Copy link
Member

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

@schmidsi
Copy link
Member Author

@ardatan
Copy link
Member

ardatan commented Oct 22, 2022

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.

@schmidsi
Copy link
Member Author

schmidsi commented Oct 22, 2022

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.

@schmidsi
Copy link
Member Author

I use Urql for now. Worked great so far.

@ardatan ardatan closed this as completed Oct 26, 2022
@schmidsi
Copy link
Member Author

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

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

No branches or pull requests

2 participants