1 thought on “angular-user-idle breaks in AOT mode

  1. OK, I had the same issue, I was unable to update the application to Angular 6 (the version of this package for Angular 6 works fine), because it is a very large app and for some other reasons. The problem here is that the package is not correctly formatted to be use as a Prod Package, according to: https://docs.google.com/document/d/1CZC2rcpxffTDfRDs6p1cfbmKNLA6x5O-NtkJglDaBVs/edit

    So, I had two options: Contribute and correct the package (which is what I should do to help others who can only use Angular 5), or solve the issue with my app as fast as I can. Well, I took the easy path which is this:

    Open your application node_modules folder and find the folder angular-user-idle grab the following files from it:
    user-idle-config.ts
    user-idle-module.ngfactory.d.ts (probably nor required)
    user-idle-module.ts
    user-idle.service.ts
    user-idle.ts

    Create a folder within your clientApp folder, for ex: angular-user-idle and put the files there.
    (in my case I used components/shared/modules/angular-user-idle).

    Now, uninstall the angular-user-idle package (“npm uninstall angular-user-idle”).

    Instead of importing the module as “angular-user-idle”.

    Import it like this:
    import { UserIdleModule } from ‘./components/shared/modules/angular-user-idle/user-idle’;
    (make sure the path matches the path where you put the files listed above)

    The rest of the configurations will work the same, just that now the package is not a package but a module within your app.

    I hope this help others.

Comments are closed.