Comments (11)
OK, so I've confirmed that TextEncoder was only added in SDK 51. Blog post here.
I am going to add an expo SDK peer dependency to stop people running into this too hard, but if anyone has to run SDK50 or below and forces past the peer requirements, it's possible to work around this issue with the text-encoding
polyfill:
npm install text-encoding
And then in the file that imports TinyBase v5:
import 'text-encoding';
cc @brentvatne
from tinybase.
Update: I've realised that enabling package exports support by setting config.resolver.unstable_enablePackageExports = true;
in the metro config file solves the issue.
So I wonder if just documenting that and asking users to enable the setting would be a better solution than having to make a drastic change to the package? (I'm afraid I don't have enough experience to know what problems that setting might cause. In a simple starter app everything is fine.)
But if you make the change I'll be very happy to try the beta
Thanks again
from tinybase.
Ugh, why are the RN imports so fiddly? I can look at this tomorrow.
from tinybase.
I think the basic problem is that the library is in lib but the types are in lib/types/with-schemas. Most bundlers get to know about this split from package.json but apparently not Metro. I'll see if I can find a way to get it to work.
from tinybase.
Ugh, why are the RN imports so fiddly? I can look at this tomorrow.
My sympathies! Thanks for taking a look
from tinybase.
OK, I have a horrible thought that the only way to fix this is to relayout the structure of the distributed package so that it matches the import pattern literally (rather than relying on the exports field in package.json).
It should be a barely breaking change but I think I need to put it in the forthcoming v5 release. Would you be OK with trying out a beta of that once I make these changes?
from tinybase.
That was going to be my other suggestion (but when I tried it it didn't work for me!). Glad you're unblocked though!
from tinybase.
I'm hoping we are past these sorts of issues in v5.0.0-beta.21
It seems to work great in your app (though still currently needs the --force install). If you get a chance could you give it a whirl yourself please? Thanks!
from tinybase.
Hi, as far as I can tell the latest beta works perfectly with expo sdk 51.
I'm afraid it seems to break apps using tinybase with expo 50 though.
As soon as I add the following
import { createStore } from "tinybase";
const store = createStore();
I get an error when running on a (real) android device. Web seems ok. (I'm not able to test iOS)
The not-very-helpful error message:
ERROR TypeError: Cannot read property 'prototype' of undefined, js engine: hermes
at ContextNavigator (http://192.168.1.17:8081/node_modules/expo-router/entry.bundle//&platform=android&dev=true&hot=false&lazy=true&transform.engine=hermes&transform.bytecode=true&transform.routerRoot=app:149934:24)
at ExpoRoot (http://192.168.1.17:8081/node_modules/expo-router/entry.bundle//&platform=android&dev=true&hot=false&lazy=true&transform.engine=hermes&transform.bytecode=true&transform.routerRoot=app:149890:28)
at App
at ErrorToastContainer (http://192.168.1.17:8081/node_modules/expo-router/entry.bundle//&platform=android&dev=true&hot=false&lazy=true&transform.engine=hermes&transform.bytecode=true&transform.routerRoot=app:194841:24)
at ErrorOverlay
at withDevTools(ErrorOverlay) (http://192.168.1.17:8081/node_modules/expo-router/entry.bundle//&platform=android&dev=true&hot=false&lazy=true&transform.engine=hermes&transform.bytecode=true&transform.routerRoot=app:194591:27)
at RCTView
at View (http://192.168.1.17:8081/node_modules/expo-router/entry.bundle//&platform=android&dev=true&hot=false&lazy=true&transform.engine=hermes&transform.bytecode=true&transform.routerRoot=app:40188:43)
at RCTView
at View (http://192.168.1.17:8081/node_modules/expo-router/entry.bundle//&platform=android&dev=true&hot=false&lazy=true&transform.engine=hermes&transform.bytecode=true&transform.routerRoot=app:40188:43)
at AppContainer (http://192.168.1.17:8081/node_modules/expo-router/entry.bundle//&platform=android&dev=true&hot=false&lazy=true&transform.engine=hermes&transform.bytecode=true&transform.routerRoot=app:39999:36)
at main(RootComponent) (http://192.168.1.17:8081/node_modules/expo-router/entry.bundle//&platform=android&dev=true&hot=false&lazy=true&transform.engine=hermes&transform.bytecode=true&transform.routerRoot=app:124871:28)
I've added a branch to my reproduction repo which downgrades from expo 51 to 50 and uses the latest tinybase beta. If you uncomment the lines above in app/(tabs)/index.tsx
you'll see the error. Link: https://github.com/mdj-uk/cea/tree/expo-50 (Downgrading to tinybase@latest there's no problem.)
from tinybase.
what the what
from tinybase.
Yeah I can repro this on iOS too. Error indicates it doesn't like this integer 🤔 but more likely it's the TextEncoder above it...
from tinybase.
Related Issues (20)
- Add Zod and Effect Schema support for better DX HOT 9
- Consider using Bun for the development of TinyBase itself HOT 1
- Persist TinyBase to Astro DB
- Support TS `moduleResolution: node16` HOT 5
- Loro CRDT Addition
- 'Pagination' for SQLite persistence
- Extra persister events (start + finish) HOT 2
- ESlint errors from import/no-unresolved HOT 9
- Object-based hooks should return same ref if unchanged HOT 3
- useSetRowCallback is recreated when rowId is a function HOT 1
- Expose @types/_internal HOT 2
- WebRTC Synchronizer HOT 3
- Expo not marked as optional peer HOT 3
- Clarity around getPersisted returning undefined HOT 13
- Add hasSlice and useHasSlice
- Default value in values schema is being sent as a write op to connected peers
- Expose `createSqlitePersister` in package for custom SQLite set-ups HOT 3
- Automerge persister clears the document contents on startup HOT 3
- getUniqueId missing documentation
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tinybase.