Reputation: 10828
When importing a custom library generated through ng generate library my-lib --prefix=my-lib
and then importing in the project, everything works smooth.
After creating a second module inside the my-lib
, also reusing it in the app is not a problem.
However as soon as I try to build with aot it fails with Please add a @NgModule annotation
for my custom module.
I use barrels in each folder of the libary to export the modules.
Upvotes: 0
Views: 428
Reputation: 10828
In order to successfully build with aot, you need to specify the full path to the index of the barrel in the consuming barrel and not just the folder.
in index.ts
instead of:
export * from './my-custom-ui-component';
it has to be:
export * from './my-custom-ui-component/index';
There is an issue about it:
See Issue: https://github.com/dherges/ng-packagr/issues/917
Upvotes: 1