-
-
Notifications
You must be signed in to change notification settings - Fork 366
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
Restore main
field in package.json
#342
Conversation
…er (metro) issues
Issue #340 mentions other tools that are also breaking due to lack of I'm personally in favor of merging this fix. Though, I'd really like to understand the root cause first. Ky is a valid package and Node's |
I think webpack or metro are designed to actively check specific keys in your package.json in a specific, user-configurable order, (eg. |
Sure, I am aware of that behavior and it's a good point that the problem likely stems from how they detect which key to use. However, I would expect that once they find the |
As I mentioned in #340 (comment), importing Ky from the unpkg CDN is also broken and I believe it's a similar root cause, meaning this will likely fix that, too. It would seem that a lot of the ecosystem is just implementing their own algorithms for finding the main entry point instead of using Node's |
I experienced the same issue using the last version of ky with a Typescript web app and ESM imports. This PR fixes the issue. |
@sindresorhus any chance you could merge & release quickly this change as it is breaking many setups? Thanks! |
main
field in package.json
Sorry for the slow reply. Somehow I got accidentally unsubscribed to the Ky repo. |
[email protected]
can't be used in react-native apps anymore due to a missing main field inpackage.json
.Metro does provide configuration options to support extra "main" fields but adding
"exports"
there breaks as other packages start to use this field instead of their"main"
(not sure why, as it is expected to be an ordered check, maybe a metro-related bug of the"exports"
key handling when in object form). Haven't found a way to make it work except manually patching the ky's package.json.