-
Notifications
You must be signed in to change notification settings - Fork 107
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
First off just wanted to say i love this package and how easy to understand the code is for something so complex. ππ½
I was experimenting a bit with running capnweb inside a react-native app.
Surprisingly there was not very much that didn't work from what i could tell.
I did however come across a couple minor issues that i had to patch. Wanted to share those here in hopes that we can upstream something to allow running capnweb in react-native with no patches.
- Hermes (react-native's JS runtime) does not support
Promise.withResolvers - Metro gets tripped up on the dynamic import.
Promise.withResolvers
To fix the withResolvers issue I was able to fix this by adding a polyfill (Although a more robust polyfill may be needed for better memory management??, Not entirely sure as i didn't profile):
import { Platform } from 'react-native'
if (Platform.OS !== "web") {
globalThis.Promise.withResolvers = function () {
let resolve, reject;
const promise = new Promise((res, rej) => {
resolve = res;
reject = rej;
});
return { resolve, reject, promise };
};
}Dynamic Imports
For the dynamic imports this PR seems to fix the bundling issues #82
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working