Feature Request
Ionic version:
[x] 5.x
Describe the Feature Request
Currently, during the build (as configured by Ionic CLI), ALL ionicons are copied to the assets/ directory during a production build. This results in upwards of 5.3 MB of icons being copied and uploaded or packaged via Capacitor, which is often as big as or larger than all the app code being deployed.
This means that if the service-worker 'precache' / 'eager' mode is used to pre-download all assets for offline use, each client must download all of these unused icons --- resulting in hundreds of network requests, and a LOT of space used by the service-worker cache that could be used on actual application data.
Describe Preferred Solution
There needs to be a pre-build step where the application source-code is analyzed, including a hook for any custom / runtime-generated icon use, that copies only the required icons. This would greatly reduce the size of deployed apps. Even with modern cell networks, most of the world still only has 3G or weak 4G at best, and this optimization could be a huge savings.
As far as I can tell, ionicons is the only part of the build process that has this gap. Most modern tools now provide tree-shaking / dead code removal, and ionicons really needs this feature.
Describe Alternatives
None currently exist other than, I suppose, one could attempt to write a custom script to implement this feature.
Related Code
Additional Context
#637
Feature Request
Ionic version:
[x] 5.x
Describe the Feature Request
Currently, during the build (as configured by Ionic CLI), ALL ionicons are copied to the
assets/directory during a production build. This results in upwards of 5.3 MB of icons being copied and uploaded or packaged via Capacitor, which is often as big as or larger than all the app code being deployed.This means that if the service-worker 'precache' / 'eager' mode is used to pre-download all assets for offline use, each client must download all of these unused icons --- resulting in hundreds of network requests, and a LOT of space used by the service-worker cache that could be used on actual application data.
Describe Preferred Solution
There needs to be a pre-build step where the application source-code is analyzed, including a hook for any custom / runtime-generated icon use, that copies only the required icons. This would greatly reduce the size of deployed apps. Even with modern cell networks, most of the world still only has 3G or weak 4G at best, and this optimization could be a huge savings.
As far as I can tell, ionicons is the only part of the build process that has this gap. Most modern tools now provide tree-shaking / dead code removal, and ionicons really needs this feature.
Describe Alternatives
None currently exist other than, I suppose, one could attempt to write a custom script to implement this feature.
Related Code
Additional Context
#637