-
Notifications
You must be signed in to change notification settings - Fork 151
Closed
Description
Environment
React Native / Metro
Reproduction
The lib is not usable in React Native context.
Metro won't resolve properly the correct build in package.json:
- He, by default, will look at
"main"entry which is the node one. - He also fails because he expects the entry
package.jsonin"exports"(don't ask me why).
(one could be inspired by axios package.json which is well tested for node, browser and react-native)
Describe the bug
- React Native app will fail on
import http from 'node:http'because it uses the node build. - Then, if corrected, it will ignore the package because
package.jsonis not found in package.json 🙈
Additional context
In package.json, do these updates:
- "main": "./cjs/node.cjs",
+ "main": "./cjs/index.cjs",and
"exports": {
+ "./package.json": "./package.json"Beware that this should also be done in all unjs (awesomes) packages so that they can be used standalone in React Native.
Logs
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels