I am using ionic v4 and lazy loading in my app like
@NgModule({
imports: [
RouterModule.forRoot(routes, {
useHash: false,
preloadingStrategy: PreloadAllModules,
})
],
exports: [RouterModule]
})
export class AppRoutingModule {
}
but pages which use ionic elements take some time to show when I click the button for the first time. Repeat clicks show pages much faster.
Here is “Followers” page network tab screenshot after the first click:
Here is “Followers” page network tab screenshot after the second click:
Also inserting video example maybe it would be more clear what is the problem:
As you see clicking the page second time doesn’t load any js chunks and page opens instantly. So my question is how to preload those js chunks so I can improve user experience when they open my app pages for the first time?