Open RangerMauve opened 4 years ago
Won't that push the entire node_modules
into the app build? I've tried a similar alternative to run a full IPFS node on a React-Native app and in the end the app had about to 500MB. This is not something I'd call ideal...
Would it be possible to just pull a compiled version of the code or something like that into nodejs-mobile-react-native
directory somehow?
Edit: typo
I'm not sure actually. It might be possible to browserify the bundle and just include the binaries in the folder. I wonder if there are tools that do this already?
There's also an effort to make it work with regular react-native: https://github.com/cliqz/dat-react-native/ If they can get decent performance out of it then nodejs-mobile wouldn't be needed.
Yes, react-native out of the box would be ideal. However, we have a working app that runs hypercore, networking, crypto, leveldb in nodejs-mobile, it's pretty small actually given it's bundling node, the APK is 89MB. https://github.com/digidem/mapeo-mobile
It takes a bit of effort to make sure it works well in the background, but this is mostly app logic not too different from programming in electron
Hello all. Not sure if the following would help, but I'm attempting this at the moment using nodejs-mobile-react-native.
To hopefully answer @fmsouza question and confirm @RangerMauve's suggestion:
I've found moving the node_modules
folder outside of the nodejs-project
into it's parent nodejs-assets
works (as node
will still resolve a package one level up).
My webpack.config.js
output's to ~/nodejs-assets/nodejs-project/main.js
. Folder structure is as follows:
.
+-- nodejs-assets
| +-- node_modules
| +-- nodejs-project
| | +-- main.js
| +-- src
| | +-- index.js
| +-- package.json
| +-- webpack.config.js
Only issue is nodejs-mobile
doesn't currently support WebAssembly on iOS (ChakraCore) so DatSDKs version of sodium won't run.
Making attempts this week irrespective.
@martinheidegger and I are currently working on making sure sodium-javascript works in RN.
We're setting up a continuous integration testing suite that'll run it on RN and then we'll be fixing bugs.
Actually, @LeslieOA would you be down for chatting more about how we could collaborate on pushing this RN stuff forward? My email is ranger@mauve.moe
Actually, @LeslieOA would you be down for chatting more about how we could collaborate on pushing this RN stuff forward? My email is ranger@mauve.moe
Emailed 🙂
Now that we have hyperspace support in the SDK it might make sense to use nodejs-mobile to spin up a hyperspace instance on the native side and use just the client portion for hyper-sdk in the react-native thread.
Make a wrapper over the SDK using nodejs-mobile-react-native and provide it to React-Native apps.