talsec / Free-RASP-ReactNative

React Native plugin for improving app security and threat monitoring on Android and iOS mobile devices.
https://github.com/talsec/Free-RASP-Community
MIT License
77 stars 8 forks source link

Package Size is concerning. #45

Closed asharamseervi closed 4 months ago

asharamseervi commented 4 months ago

Is your feature request related to a problem? Please describe.

I have a limited understanding of packages, but I believe package size matters. While drafting this Unpacked Size is 11.8 MB while going through https://www.npmjs.com/package/freerasp-react-native?activeTab=code, I got to know, ios directory itself is about 11.2 MB while I plan to protect Android app.

Describe the solution you'd like As per my limited understanding, for a npm package lib and other root files like package, readme, licence, src required until and unless some native android or ios specific functions is desired. Most of the package is already covered in the lib directory, which is required to be extended by app developers.

Removing and adding example, android and ios in .npmignore will remove these directories for npm directory and significantly improve the app size.

Additional context Please correct me if I am wrong. For a package or app, every KB matters.

tompsota commented 4 months ago

Hi @asharamseervi,

Thanks for opening the issue.

freeRASP for React Native is a wrapper around native iOS and Android implementations. Therefore, the content of android and ios folders is necessary for the plugin to work.

example folder is not required in npmjs installation and could be removed, we'll think about adding this to our backlog.

However, removing these folders won't have any effect on the final size of your APK/AAB. Shortly, this is because when you are building your Android app, just the common .js/.ts files and native Android files (in android folder) are compiled. The rest is thrown away.

So if you are using just the Android implementation, you can delete the ios folder from the plugin in _nodemodules. This will hovewer affect only size on your drive, not the final build, because of the reasons mentioned above.

Cheers, Tomas

tompsota commented 4 months ago

Moving the thread to Discussions. Feel free to continue discussion there, or create another issue if relevant.