Skip to content
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

Error/Warning in React Native with latest Beta: Package swr has been ignored because it contains invalid configuration. Reason: Package subpath './package.json' is not defined by "exports" #1310

Closed
beetlebum opened this issue Jul 27, 2021 · 3 comments · Fixed by #1313

Comments

@beetlebum
Copy link

Having just installed the latest version of swr "swr": "^1.0.0-beta.9" with React Native "react-native": "^0.64.2", the Metro Bundler shows the following warning:
warn Package swr has been ignored because it contains invalid configuration. Reason: Package subpath './package.json' is not defined by "exports" in /Users/.../node_modules/swr/package.json

Node version v16.5.0

@huozhi
Copy link
Member

huozhi commented Jul 28, 2021

I'm playing react native with expo, didn't have see any warinings for it when I installed swr 1.0.0-beta.9.

IMO a library doesn't have to define package.json in exports if it's not necessary. Found a related issue of react-native cli itself here. Looks like it has some problem with resolving package.json. The issue is more like on react native cli side.

@huozhi huozhi closed this as completed Jul 28, 2021
@huozhi huozhi linked a pull request Jul 30, 2021 that will close this issue
@huozhi
Copy link
Member

huozhi commented Jul 30, 2021

@beetlebum package.json exports is still added in #1313 since other bundler might also have this issue when resolving <module>/package.json. Will be released into next round. Thanks for reporting! 🙏

@beetlebum
Copy link
Author

@beetlebum package.json exports is still added in #1313 since other bundler might also have this issue when resolving <module>/package.json. Will be released into next round. Thanks for reporting! 🙏

thank you @huozhi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants