We are using Lazy Loading for Router Modules.
{
path: 'users',
loadChildren: 'app/users/users.module#UsersModule',
},
But when we update version of our app (upload new bundle to the server) it's always broken: old app (that user has already downloaded) tries to get old chunk file that is not on the server anymore.
Live example: https://alexshakura.github.io/chunk-error/ (I've just rename the chunk to highlight the error)
What is the correct way to handle this error?
Let me describes the steps:
- AppVersion1 is loaded by a user (without lazy loaded chunks)
- We updated the app and uploaded bundle to the server (so currently AppVersion2 is correct one)
- User (who still has AppVersion1) goes to route that loads lazy module, BUT it tries to load chunk from AppVersion1 that does not exist anymore.