NativeBase icon indicating copy to clipboard operation
NativeBase copied to clipboard

App builds with NativeBase carry needless bloat

Open prometheas opened this issue 5 years ago • 11 comments

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!

prometheas avatar Oct 14 '20 18:10 prometheas

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] avatar Dec 21 '20 11:12 stale[bot]

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: image When I actually only need my one custom fonts and two icons library (material and ionicons) :/

pierroo avatar Nov 02 '21 17:11 pierroo

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] avatar Feb 02 '22 04:02 stale[bot]

Actually I wish it got the attention it deserves without being closed; I still believe NativeBase brings along a too heavy package...

pierroo avatar Feb 02 '22 08:02 pierroo

@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!

surajahmed avatar Feb 03 '22 08:02 surajahmed

Fair enough. Software is hard. Looking forward to it.

prometheas avatar Feb 03 '22 21:02 prometheas

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] avatar Apr 06 '22 17:04 stale[bot]

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 avatar Apr 07 '22 15:04 prometheas

@prometheas Sorry for the inconvenience. I know this is frustrating. We're working on it and try to fix this as soon as possible.

surajahmed avatar Apr 21 '22 07:04 surajahmed

Eh. Software is hard. The update does help us with our considerations, though. Good fortunes!

prometheas avatar Apr 27 '22 21:04 prometheas

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] avatar Jun 27 '22 20:06 stale[bot]

@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)

michaelangeloio avatar Sep 22 '22 15:09 michaelangeloio