Skip to content

Optimize bundle size and startup time

Martin Santangelo requested to merge native/optimize into develop

Ticket(s) / Related Merge Requests

#5139 (closed) https://gitlab.com/minds/minds/-/issues/4299

Results

  • Reduced the startup by more than 50%
  • Reduced the JS bundle size by 25%
  • Reduced the initial loaded modules from 1436 to 345

Summary of Changes

  • Replaced the react-native-phone-input package with a variant with an alternative JS implementation (Google's phone input validation JS library takes 550kb)

  • Removed all the polyfills used by the crypto implementations (Currently unused)

  • Removed unused dependencies

  • Removed unused code & clean up

  • Removed the embedded friendly captcha JS and used CDN instead

  • Replaced bn.js with react-native-bignumber (5x smaller and 300x faster)

  • Updated react-native-calendar to reduce the bundle size

  • Added plugins to metro to check duplicated dependencies and circular dependencies

  • Removed duplicated dependencies

  • Optimized the initially loaded modules

  • Fixed some circular dependencies errors with the session service

  • Removed the initial codepush checks

  • Changelog file updated with this template (one or more)

Testing Considerations

General smoke testing will be required

Regression Scope

It affects the initialization of the app but it may affect other parts of the app

Platform Affected (web, mobile, etc)

both

Developer Testing Completed

Android device

Screenshots

(Any extra UI screens that can be shared)

Does this impact

  • Localization
  • Dark/light mode
  • Guest mode
Edited by Martin Santangelo

Merge request reports