8

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?

Hugo B.
  • 471
  • 1
  • 8
  • 23

1 Answers1

-2

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.

Jeremy Caney
  • 7,102
  • 69
  • 48
  • 77