-
Notifications
You must be signed in to change notification settings - Fork 36
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
fix(pkg): add main
field
#678
Conversation
Some tools don't play well with only having the `exports` field present. See octokit/core.js#662
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 don't like it but if that's what it takes to remove some upgrade pain, let's do it. Do you know what build tools are affected? If it's only ncc
, maybe it's something that could/should be fixed on their side?
I'm a bit concerned that we will forget why the main
key is there as we cannot add a comment. Should we maybe add a mini test to make sure it doesn't get removed by accident? Then the test can have comments and an explanation
@@ -61,6 +61,8 @@ async function main() { | |||
{ | |||
...pkg, | |||
files: ["dist-*/**", "bin/**"], | |||
main: "dist-bundle/index.js", | |||
types: "dist-types/index.d.ts", | |||
exports: { | |||
".": { | |||
types: "./dist-types/index.d.ts", |
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.
did you try to replace with exports: "./dist-bundle/index.js"
and just add the types
key to the pkg root?
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.
It's not just ncc, typescript, and eslint as well are having some issues resolving Octokit packages.
I have tried that syntax and I had some issues.
Might just try again.
As for comments, we can leave one in the build file
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.
As for comments, we can leave one in the build file
right!
I see the similar change in most of the other |
I haven't had a chance to do follow up tests to some suggestions in the comments. It will get merged ASAP |
I did some testing, and it seems that the idea suggested in #678 (comment) does not seem to work. I tested this on this plugin, by modifying the
Everything resolves fine in Jest when the tests are TypeScript. However, TypeScript cannot resolve the module during the build, or in the IDE.
I have been following the Webpack guide on the exports field and the Pure ESM Package gist from sindresorhus |
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.
thank you for digging into it
🎉 This PR is included in version 9.0.3 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Some tools don't play well with only having the
exports
field present.See octokit/core.js#662