Tinybase not compatible with metro in react-native
See original GitHub issueDescribe the bug
Hello, I’m trying to use tinybase for a project with react-native and I keep getting this error:
While trying to resolve module `tinybase` from file `---path---\App.tsx`, the package `--path--\node_modules\tinybase\package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`--path---\node_modules\tinybase\index`. Indeed, none of these files exist.:.....
In my opinion, looks like metro has issues with the way the package is exported in package.json and cannot resolve the correct path.
Your Example Website or App
React native is not an option in stackblitz
Steps to Reproduce the Bug or Issue
- Initialize a react native app
- Install tinybase
- Import and interact with tinybase
Expected behavior
I would expect tinybase to work similar to how it does in a react or next app, with webpack.
Screenshots or Videos
No response
Platform
- OS: [macOS, Windows, Linux]
- Browser: [Chrome, Safari, Firefox]
- Version: [e.g. 91.1]
Additional context
No response
Issue Analytics
- State:
- Created a year ago
- Comments:7 (6 by maintainers)
Top Results From Across the Web
React-Native IOS real device does not connect to Metro server
I think that this was the main problem in my situation. Turn off the metro, the app usually starts (because the native app...
Read more >This Week In React #120: use RFC, Sandpack, Storybook ...
In a React context, the libraries used (Helmet, CSS-in-JS, Redux...) must be compatible for streaming to be effective. Storybook - First- ...
Read more >TinyBase (@tinybasejs) / Twitter
The reactive data store for local‑first apps. In your JavaScript app. tinybase.org Joined January 2022 ... v1.3.2 Support for TinyBase in React Native....
Read more >This Week In React #100: React 18, React-Native 0.68, Redwood ...
Hi everyone! Lots of things happened during my ski holiday We cover React 18, React-Native 0.68, and 2 weeks of full of news....
Read more >react native metro bundler not starting : Solved Solution
Recently a lot of programmers are having issue on using a react native init application to start an app all because of a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
OK, fixed. Please update to v1.3.2. This adds a
"react-native"
field topackage.json
that allows Metro to find the file directly (since it doesn’t currently supportexports
).The
ui-react
library works too! - because it doesn’t rely on the HTML DOM. But Note that until Metro fixes https://github.com/facebook/metro/issues/670 you will still have to be slightly creative and reference it explicitly from the lib folder directly:Have fun and let me know how it goes!
Oh no! I wonder if you can use
tsconfig
to force it to resolve the.d.ts
at that path? Or try some explicit things in thetypesVersions
field in package.json. Happy to merge in anything that fixes it until https://github.com/facebook/metro/issues/670 happens.