'Unsupported private class xy' while building Angular library
Asked Answered
K

1

9

I'm developing an npm package with Angular. While building the lib, I get the following error:

Unsupported private class MyLibComponent. This class is visible to consumers via MyLibModule -> MyLibComponent, but is not exported from the top-level library entrypoint.

I found this question. This explains how I fix it, but not why I need to put all components in the barrel file as the Angular documentation for NgModules says:

Exported declarations are the module's public API.

Can someone explain this to me?

Khaddar answered 18/3, 2021 at 8:37 Comment(1)
Did you read my question? ;)Khaddar
R
-1

Please make sure that the component has been exported to your public-api.ts as:

export * from './lib/my-lib/my-lib.component';

and export the component from your library module, too.

Rexrexana answered 17/8, 2023 at 14:39 Comment(3)
Did you read my question?Khaddar
This solved my problem :)Dhaulagiri
@HugoB. he read my mind :)Dhaulagiri

© 2022 - 2024 — McMap. All rights reserved.