I just switched from CRA to Vite to build my app.
lazy loading seems to work quite differently in Vite.
For example, I only use the IonDatetime component for a single component in my app. This component is lazy-loaded deep inside the app.
With CRA, ion-datetime is correctly bundled with the component that includes it.
But with vite, ion-datetime is bundled with all the other ionic-react components, making the initial bundle size much larger.
I tried lazy-loading IonDatetime itself, but this still doesn’t decrease the initial bundle size.
Is there a way to lazy-load the individual ionic components when building with Vite in React?
To be specific, I’m talking about cases like this:
import { IonDatetime } from '@ionic/react';