We have a library project that lives in an nx project that we publish to npmjs. It's a collection of components derived from @angular/material. The library is published to npmjs @vdlx/vdl-angular.
Our build uses ng-packagr to build each of the components successively based on their dependencies.
When installed from npm into either clean angular-cli or nx project, the ng build
command works fine but the ng build --aot
fails with errors.
Within the library nx project building the apps with aot works fine, likely because it gets the components from the source (vs node_modules or the project /dist folder).
ERROR in ./src/app/app.module.ngfactory.js
Module not found: Error: Can't resolve 'badge' in '/Users/dale.manthei/Downloads/angular-hrvy5y/src/app'
Here is a simple recreate for the problem: https://stackblitz.com/edit/angular-hrvy5y?file=src%2Fapp%2Fapp.module.ts.
It works in the stackblitz for sure. Installing the project locally and running the ng build --aot
fails.
I suspect there is something missing from our library that the angular-cli project expects to be there. So far I have been trying to work with the consuming application but no joy there.
Suggestions welcome.