Issue Building Production When Including Angular2 Library


I’m trying to build production and an Angular2 library seems to be causing an issue. Ngc outputs:

build prod failed: can’t find symbol KeyRegistry exported from the module C:/path-to-project/node_modules/library-i’m-using/node_modules/@angular/core/src/di/reflective_key.d.ts.

Any idea on what the library needs to do in order to avoid this error?

I’m on Ionic2 RC1 which utilizes Angular2 v2.0.0 while the library is using the 2.4.10 build of Angular2.

Any help is greatly appreciated.


That sounds like a recipe for pain. Can you try upgrading to Ionic 2.2.0?

Unfortunately we’re really close to production and Ionic2 RC2 and later introduced a bug that didn’t exist in RC1. Here’s the github issue.

Turns out it was the library I was using. In order for AOT compilation to work you need to run the Angular2 compiler (ngc) on the source instead of just the regular typescript compiler (tsc). I might post a guide on how to do that since I didn’t see any good guides out there.