I have a component library that I've created in Typescript and Angular 2. This library is consumed by my web applications via npm. The component library itself builds using both JIT and AOT compilation, but the web application which consumes it will only build successfully using JIT compilation and errors using AOT compilation.
Previously, I had an error which said MyComponentsModule is not an NgModule or something to that effect. This was solved by generating the .metadata.json files using the Angular compiler (ngc) and including them in my node module.
The error I'm currently getting is
ERROR in Unexpected token t in JSON at position 556, resolving symbol AppModule in C:/Projects/MyWebApplication/src/app/app.module.ts, resolving symbol AppModule in C:/Projects/MyWebApplication/src/app/app.module.ts
.
This error itself doesn't actually tell me which JSON file that the problem is in. However, there is another message reported further up in the build process (which I can only assume is related), which states
Failed to read JSON file C:/Projects/MyWebApplication/node_modules/mycustompackage/definitions/components/address-search/address-component.metadata.json
.
The address component is one of the components I have created, and the file specified is the metadata that was generated for it by ngc.
Any suggestions or avenues of investigation would be much appreciated.