waku-org / js-waku

JavaScript implementation of Waku v2
https://js.waku.org
Apache License 2.0
162 stars 41 forks source link

feat: add react-native polyfills #1915

Closed weboko closed 3 months ago

weboko commented 4 months ago

Problem

ReactNative can use two types of bundler:

Following dependencies were a cause of failure for ReactNative app:

dns-query
- require("url")

multiformats
- TextEncoder
- TextDecoder

@libp2p/interfaces
- EventTarget

Solution

Metro bundler is still not compatible by default with exports map so unstable_enablePackageExports should be enabled explicitly.

As for problems with polyfills - this package addresses it.

github-actions[bot] commented 3 months ago

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
Waku node 185.75 KB (0%) 3.8 s (0%) 3.9 s (+43.4% 🔺) 7.6 s
Waku Simple Light Node 185.45 KB (0%) 3.8 s (0%) 2.5 s (-30.58% 🔽) 6.2 s
ECIES encryption 22.88 KB (0%) 458 ms (0%) 1.1 s (+11.86% 🔺) 1.6 s
Symmetric encryption 22.42 KB (0%) 449 ms (0%) 824 ms (+15.83% 🔺) 1.3 s
DNS discovery 73.67 KB (0%) 1.5 s (0%) 3.2 s (+27.14% 🔺) 4.6 s
Peer Exchange discovery 75.37 KB (0%) 1.6 s (0%) 2.6 s (+19.21% 🔺) 4.1 s
Local Peer Cache Discovery 68.99 KB (0%) 1.4 s (0%) 2.8 s (-2.91% 🔽) 4.2 s
Privacy preserving protocols 39.97 KB (0%) 800 ms (0%) 2.6 s (+46.91% 🔺) 3.4 s
Waku Filter 20.11 KB (0%) 403 ms (0%) 760 ms (-24.96% 🔽) 1.2 s
Waku LightPush 115.41 KB (0%) 2.4 s (0%) 3.8 s (+17.56% 🔺) 6.1 s
History retrieval protocols 116.05 KB (0%) 2.4 s (0%) 4.6 s (+13.72% 🔺) 6.9 s
Deterministic Message Hashing 4.96 KB (0%) 100 ms (0%) 103 ms (+17.35% 🔺) 202 ms