-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
ESM compliant bundling #3521
ESM compliant bundling #3521
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 340f29b:
|
Looks like it failed on node v12 because a dependency required at least node v14. Considering v12 is about to go EOL in 13 days, maybe it should be removed from CI? |
yes, we can totally do that for v4 |
Codecov Report
@@ Coverage Diff @@
## beta #3521 +/- ##
=======================================
Coverage 96.93% 96.93%
=======================================
Files 47 47
Lines 2381 2381
Branches 709 709
=======================================
Hits 2308 2308
Misses 71 71
Partials 2 2 Continue to review full report at Codecov.
|
Thanks. Can you add some notes to the v4 migration guide about what the breaking changes are? |
Hmnm, I just tried out the codesandbox preview link from above: and I got:
coming from the |
Well that's unfortunate and I'm really not sure why it's happening. It would help if I could examine the output but doesn't seem like that's possible on CSB. Seems like it's not an issue in |
no, it does seem to be an issue with the devtools. The devtools are a separate entry point, but they import directly from But, whatever you just changed, it seems to be working now 🎉 |
Awesome! It was probably that I set it up to resolve |
you are right. in that example, we are using the |
thanks. I'm still seeing size differences I cannot quite explain. Compared to ESM PR: dist/broadcastQueryClient-experimental.production.min.js: 3.55KB
BETA : dist/broadcastQueryClient-experimental.production.min.js: 3.55KB
ESM PR: dist/createAsyncStoragePersister.production.min.js: 625B
BETA : dist/createAsyncStoragePersister.production.min.js: 625B
ESM PR: dist/createWebStoragePersister.production.min.js: 674B
BETA : dist/createWebStoragePersister.production.min.js: 674B
- ESM PR: dist/persistQueryClient.production.min.js: 2.19KB
+ BETA : dist/persistQueryClient.production.min.js: 1.4KB
ESM PR: dist/react-query-core.production.min.js: 9.85KB
BETA : dist/react-query-core.production.min.js: 9.85KB
ESM PR: dist/react-query-devtools.production.min.js: 13.71KB
BETA : dist/react-query-devtools.production.min.js: 13.71KB
- ESM PR: dist/react-query.production.min.js: 11.36KB
+ BETA : dist/react-query.production.min.js: 11.3KB so it looks to me like some code of the that was previously in the |
Looks like that was caused by upgrading to the very latest version of |
splendid 🤩 . We can take a look at the latest rollup plugin separately. would be curious to know what is changing here :) |
🎉 This PR is included in version 4.0.0-beta.6 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Since |
@latin-1 when are you getting this error? @sachinraja can you have a look please? |
@TkDodo I got that error from Webpack. In Webpack 5, |
I don't have time to fix it right now, but @latin-1 is correct. We should change all instances of importing from |
@latin-1 can you contribute that maybe ? |
@TkDodo I'm not sure exactly what happened but it seems like this was (unintentionally?) reverted when the project was converted to a monorepo. The package no longer has (standards-compliant) ESM support and this note in the migration docs is not true. |
@sachinraja yes, seems so. Can you fix it please? |
@sachinraja I'm pretty sure this is also stopping me from fixing this issue: I tried to make the exports conditional, but it doesn't work for the esm builds. I remember you changed something there as well? |
closes #3513
"exports"
package.json
. Individual package.json files are not esm-compliant and this is already handled by"exports"
.lib
instead of a separatetypes
directory. This will help support TypeScript, which will add support for"exports"
in the next release.Unfortunately this makes the process of adding a new export more difficult:
scripts/rollup/umd-config.js
"exports"
"exports"
tsconfig.types.json