angularangular8angular-cli-v8

angular 8 prod mode import then catch throws compiler not found error


java spring 5, Angular 8+ with Cli 8+

I have lazy lazy load enable for modules which looks as following and works perfectly fine build with or without --prod flag

{
  path: 'abc'
  loadChildren: () => import('abc.module').then(m => m.abcModule )
}

If server session is expired module loading just blows up and won't do any thing so i added catch block after then as following which builds fine in both with or without prod mode, but with prod mode build when i click on route abc in browser gets following error.

{
      path: 'abc'
      loadChildren: () => import('abc.module').then(m => m.abcModule )
                          .catch( () => window.location.reload() )

    }


Error: Uncaught (in promise): Error: Runtime compiler is not loaded
Error Runtime compiler is not loaded
at Xi.Gi(main-es2015.50abc434343..js)

i am scratching my head not sure about this, can some one help ?


Solution

  • problem is solved after i upgraded angular and cli version to 9.