App builds with NativeBase carry needless bloat
I have gone through these following points
- [x] Check latest documentation: https://docs.nativebase.io/
- [x] Check for existing open/closed issues for a possible duplicate before creating a new issue: https://github.com/GeekyAnts/NativeBase/issues
- [x] Use the latest NativeBase release: https://github.com/GeekyAnts/NativeBase/releases
- [n/a] Check examples from NativeBase KitchenSink https://github.com/GeekyAnts/NativeBase-KitchenSink
- [n/a] For discussion purpose make use of NativeBase Slack: http://slack.nativebase.io/
- [n/a] For queries related to theme, check Theme Variables from Docs and live NativeBase Theme Editor http://nativebase.io/customizer/
Issue Description
I would like to see Native Base reduce its build bloat, by offering the option to omit unused resources, like the dozen icon fonts.
node, npm, react-native, react and native-base version, expo version if used, xcode version
n/a
Expected behaviour
Smaller builds.
Actual behaviour
Larger builds 😉
Steps to reproduce
Run react-native link on a project with Native Base installed and behold!
Is the bug present in both iOS and Android or in any one of them?
It's present in both, but Native Base has the even-worse behavior for Android of installing copies of the fonts into the versioned /android directory.
Any other additional info which would help us debug the issue quicker.
###Important
If you want your issue to be looked at quicker, attach a snack reproducible with your issue. Makes it easier for us!
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Did you find any solution to this?
I just realized the multiple MBs added to the build after adding custom fonts and having to use react-native link.
Now my android\app\src\main\assets\fonts is filled with all these:
When I actually only need my one custom fonts and two icons library (material and ionicons) :/
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Actually I wish it got the attention it deserves without being closed; I still believe NativeBase brings along a too heavy package...
@prometheas Apologies for the delay in replying! We were busy with our latest release. I know this is frustrating that NativeBase includes needless bloat. We've added this to our list, hope to fix this in next release 🤞 Thanks for reporting!
Fair enough. Software is hard. Looking forward to it.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Stale bot closed this issue again. How'd it this effort turn out?
Full disclosure: I'm asking in part because my team and I are at a juncture where we'll either wind up upgrading from 2.x to 3.x or drop NativeBase altogether from our project.
@prometheas Sorry for the inconvenience. I know this is frustrating. We're working on it and try to fix this as soon as possible.
Eh. Software is hard. The update does help us with our considerations, though. Good fortunes!
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
@prometheas @pierroo for web and fonts, I wrote a simple script like this to clear out the unnecessary bloat. Saved a few MB.
import os
def remove_files(path):
names = ['MaterialCommunityIcons']
for root, dirs, files in os.walk(path):
for name in files:
path = os.path.join(root, name)
if os.path.isfile(path):
for n in names:
if n not in path:
print('Removing: ' + name)
os.remove(path)
os.chdir('./apps/next/deploy/.next/static/chunks/fonts')
path = os.getcwd()
remove_files(path)
os.chdir('../../../../../../../')
path = os.getcwd()
os.chdir('./apps/next/deploy/.next/server/static/chunks/fonts')
path = os.getcwd()
remove_files(path)