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

Doesn't work with Vite 3 (1) #9833

Closed
brillout opened this issue Jun 18, 2022 · 3 comments
Closed

Doesn't work with Vite 3 (1) #9833

brillout opened this issue Jun 18, 2022 · 3 comments
Assignees

Comments

@brillout
Copy link
Contributor

The React module node_modules/@apollo/client/react/ is being imported for Vue projects. I can't fathom why that is: the entire repository (see reproduction) has not a single occurrence of the word "react".

Since React is not installed (which is expected), the React dependency cannot be resolved.

Reproduction: https://github.com/brillout/graphql-apollo_vite-3_bug-1.

@benjamn
Copy link
Member

benjamn commented Jun 21, 2022

This is an accident of history (backwards compatibility) that will undoubtedly be improved in AC4 (the next major version), and is currently tracked in this issue: #8190

In the meantime, instead of importing from the top-level @apollo/client package (which regrettably includes @apollo/client/react), you can import from @apollo/client/core (which does not). In case that doesn't work, importing explicitly from the @apollo/client/core/index.js module may do the trick. I don't think Vite requires the explicit index.js module, but that trick may be useful with other bundlers.

@jpvajda jpvajda added 🏓 awaiting-contributor-response requires input from a contributor ⁉️ question labels Jun 21, 2022
@jpvajda
Copy link
Contributor

jpvajda commented Jun 21, 2022

Thanks @benjamn!

@brillout Since this is tracked in #8190 how would you feel about me closing this out for now?

@jpvajda jpvajda self-assigned this Jun 21, 2022
@jpvajda jpvajda closed this as completed Jun 22, 2022
@jpvajda jpvajda removed the 🏓 awaiting-contributor-response requires input from a contributor label Jun 22, 2022
@brillout
Copy link
Contributor Author

@benjamn Thanks for the answer. And how about #9834 (comment)?

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants