Unable to compile in React-Native
Closed this issue · 4 comments
Description
We are unable to compile and use the library in react native
Tried both es
and umd
versions
import PSIClient from '@openmined/psi.js/client/js/umd';
import PSIClient from '@openmined/psi.js/client/js/es';
node libraries seem to be required path
stream
fs
as in the attached screenshot
Despite several hacks to import and map react-native counterparts for node libraries like react-native-level-fs
readable-stream
rn-nodeify
, the issue persists
How to Reproduce
Import libraries in react native
Expected Behavior
I would expect the project to compile without errors
Screenshots
System Information
- OS (target): Androidd
- OS Version: 9
- Language Version: React Native 0.62
- Package Manager Version: Yarn 1.16, NPM 6.11
Thank you for reporting this issue. We will investigate and try and come up with a fix.
As it turns out, google protocol buffers are causing this issue that affects browsers (including react-native). We are working on a fix. In the mean time, you can use an earlier version (0.1.0).
This ended up becoming a much more complicated issue with the build toolchain.
We have a fix coming soon which is able to support WebAssembly in react-native instead of using the asm.js build which is much slower 🎉
Ultimately, the emscripten toolchain used to build the PSI bundles tries to aggressively support many environments out of the box which was causing failed imports that you were seeing among others during the discovery of the solution.
It is a work in progress and we hope to publish a fix in the next few days.