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

react-query/devtools's module entry points to a CJS file #3513

Closed
haoqunjiang opened this issue Apr 15, 2022 · 2 comments · Fixed by #3521
Closed

react-query/devtools's module entry points to a CJS file #3513

haoqunjiang opened this issue Apr 15, 2022 · 2 comments · Fixed by #3521

Comments

@haoqunjiang
Copy link

Describe the bug

Essentially reposting #3505 here.
Though Vite reverted that change, I believe it is a bug in react-query.

The module field of react-query/devtools points to a CJS file that reexports from a subfolder containing nothing but a package.json, and it expects the reexport resolves to the module field of that subfolder.

It violates the convention that module field should contain ESM syntax.


To provide different exports for different environments in the ES module system, maybe the exports field can help here: https://nodejs.org/api/packages.html#community-conditions-definitions

Your minimal, reproducible example

https://github.com/akharkhonov/vite-react-query

Steps to reproduce

  1. Install dependencies yarn --frozen-lockfile
  2. Run dev mode yarn dev
  3. Open devttools and see errors

Expected behavior

No errors.

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

  • OS: macOS
  • Browser: Chrome
  • Version: Version 100.0.4896.88 (Official Build) (arm64)

react-query version

3.34.19

TypeScript version

4.6.3

Additional context

No response

@TkDodo
Copy link
Collaborator

TkDodo commented Apr 15, 2022

I would be very grateful if you could help with fixing this. My knowledge about modules and bundling is quite limited to be honest

@tannerlinsley
Copy link
Collaborator

🎉 This issue has been resolved in version 4.0.0-beta.6 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging a pull request may close this issue.

3 participants