Repository navigation
Add exports to package.json - #5644
Conversation
🦋 Changeset detectedLatest commit: 7f22eb0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
This PR is being reviewed by Cursor Bugbot
Details
You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
|
@quantizor |
It broke a bunch of stuff unfortunately and caused issues like multiple versions of the library being loaded, type visibility problems for composite projects, etc. There's probably a different way to fix it. |
|
We can change the |
|
@quantizor can I reproduce these bugs somehow? Maybe I can add some tests |
|
I have opened this PR: There, I have mentioned the issue withthe composite projects has appeared before my change |
Hello!
I am trying to move on ESM modules in my project and on Vitest and I have started to catch errors like so:
I have this issue when I use this kind of import:
While I am writing my application over bundlers all works fine, because every bundler goes to package.json and takes "module" instruction from there.
But when I use vitest and it sees package which is marked as
"type": "module"it tries to resolve it with a Node.js module wayBy the Node.js module resolution it tries to read "exports" and if there is no information it goes to the "main" field. And there is "cjs" as you can see
Here is a scheme:
With export it will work like so:
Note
Improves Node/ESM resolution by defining an explicit
exportsmap forstyled-components.exportsinpackages/styled-components/package.jsoncovering.and./nativewithimport(ESM),require(CJS),browser,react-native, andtypes, plus./package.jsonWritten by Cursor Bugbot for commit 7f22eb0. This will update automatically on new commits. Configure here.