Open dmitriy-saltovskiy opened 10 months ago
These warnings and errors often occur due to invalid or missing configurations within the package.json
file of the package being used. To resolve these issues, follow these steps:
Check Package Configuration:
package.json
file within the bunshi
package and ensure that the exports
section defines the specified subpath or module, such as './package.json'
.Reinstall Dependencies in Your Project:
npm install
or yarn install
in a command prompt to reinstall dependencies.Update the Package Version:
bunshi
package. Newer versions might resolve these kinds of issues.Explore Alternative Solutions:
After attempting these steps, if the issue persists, consider analyzing the error message in more detail or seeking help from sources where you can find more specific information or guidance related to this error.
Thanks for the bug report @dmitriy-saltovskiy and for the resolution steps @caltikoc
I would love to see support for React Native better tested and documented.
Would either of you be open to contributing a PR with the fix and some other React Native improvements?
This is because metro does not support exports in package.json yet. But it is in beta. See this.
For me, the simplest fix was to simply import the package from bunshi/dist/react
.
It should be fixed in next versions of react-native...
Thanks for clarifying and linking out to the relevant resources @kaladivo
It might still be possible to fix this issue by changing the build and deploy process to move files from dist
into the root folder. I believe that jotai
uses this trick.
In the meantime:
import { molecule } from "bunshi/dist/react"
instead of import { molecule } from "bunshi/react"
A few possible tasks for the community to tackle if anyone is keen:
examples
folder as a test for compatibility (i.e. make sure we don't break the known workaround of import { molecule } from "bunshi/dist/react"
). See test:typings
script in package.json for reference.Hi there, any update on this issue? Seems like package exports is not supported in React native?
I tried to use it with React Native but got a warning and an error: warning:
error:
Looks like it connected to that issue https://github.com/react-native-community/cli/issues/1168