-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
feat: support exports in package.json
#11961
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
Conversation
exports in package.jsonexports in package.json
| @@ -0,0 +1,6 @@ | |||
| { | |||
| "name": "NODE_PATH_dir", | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to create this and the one below otherwise resolve finds the package.json of jest-runtime itself (which has exports, thus it fails)... Not sure how to deal with this - is it ok? If so, it's at least a breaking change
Codecov Report
@@ Coverage Diff @@
## main #11961 +/- ##
==========================================
+ Coverage 68.46% 68.47% +0.01%
==========================================
Files 324 324
Lines 16961 16968 +7
Branches 5055 5060 +5
==========================================
+ Hits 11612 11619 +7
Misses 5317 5317
Partials 32 32
Continue to review full report at Codecov.
|
|
Since I've had to add a few Alternative is to add it behind a flag, but... meh |
3b0ee8e to
2bf869c
Compare
5458af7 to
944624b
Compare
…kage exports in version 28: jestjs/jest#11961)
880f1a0 to
0e2c7d1
Compare
|
OK, I think this is good to go now. Just need to add some more tests, but from manual testing this seems to work |
exports in package.jsonexports in package.json
|
@SimenB, I have a lemming question: if we load some cjs package, which requires another package with dual export ( |
In latests versions of Node.js, if there's an |
|
Аha. It should be. But we have a custom resolver here) |
|
Yep, same here. If |
|
I'll publish a beta release after landing this (probably tomorrow), at which point people testing it would be great 🙂 There are probably still bugs here |
|
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Summary
Add support for
exportsin package.json.This is missing a bunch of tests. Also,
we need to add, and then usenodeconditionshouldLoadAsEsmon the returned value in the runtime.I also think we need to ensure
conditionsis always passed. So some stuff innormalizehave to move (specifically the stuff that is loaded in the user's env likesetuFilesetc - that needs to be provided the correct conditions)Fixes: #9771
Test plan
Will be interesting to see how CI likes this.
Some basic tests added, will add way more involved ones before merging