Slimming down build for Ionic/React?

Hey. I’m working on a mobile app with Ionic/React and things are working really well! Kudos!

I created the app with create-react-app as directed and have not ejected from c-r-a. I’m using ionic version 4.3.1 and the app will be deployed as a PWA.

I’m trying to slim down the build – both to:

a) reduce the assets in the build which will be downloaded to my PWA (currently 175 wepack “chunks” and 700 icons, for about 20 ionic components / 8 icons used), and

b) to speed the build itself up (20s/90s for dev/production builds respectively, where a non-ionic CRA app takes about 10s/45s on my machine).

Specifically, I’d like to:

  1. Make a “custom build” of ionic to only include React components that I’m actually using in the app. I’d be happy to provide a list of the exact components somewhere if it can’t be figured out automatically. Optimal would be to have control over how the components used are “chunked”.

  2. Pre-load certain IonIcons, ideally by importing them explicitly in a jsx file and exclude all other icons from the build.

I can’t find any docs for how to do this for React, only for Angular (or maybe I’m missing something?)
Any help would be appreciated!

Owen Williams