-
-
Notifications
You must be signed in to change notification settings - Fork 861
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 TypeScript types nodenext support #578
Conversation
this is great. thank you. will merge and be part of the next release soon. |
@@ -4,7 +4,10 @@ | |||
"description": "Loads environment variables from .env file", | |||
"main": "lib/main.js", | |||
"exports": { | |||
".": "./lib/main.js", | |||
".": { | |||
"default": "./lib/main.js", |
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.
Before I merge this:
can you point me to the definition of using default
rather than specifying both import
and require
? I cannot find the documentation on this.
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 also wonder if moving our type definition file under lib would solve a lot of these edge cases - from the past and going forward. That was the historical default and most editors I believe are set up to look there.
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.
doc of default
, import
and require
is here.
https://nodejs.org/api/packages.html#conditional-exports
I think it will be better if we moving our type definition file under lib
. Should I create another PR to do this?
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 agree. Can you just roll it into this PR, please? Thank you for your help!
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.
See config example at https://devblogs.microsoft.com/typescript/announcing-typescript-4-5-beta/#packagejson-exports-imports-and-self-referencing