title: 'Unsupported private class xy' while building Angular library
body: <p>I'm developing an npm package with Angular. While building the lib, I get the following error:</p>
  <blockquote>
  <p>Unsupported private class MyLibComponent. This class is visible to consumers via MyLibModule -&gt; MyLibComponent, but is not exported from the top-level library entrypoint.</p>
  </blockquote>
  <p>I found this <a href="https://stackoverflow.com/questions/60121962/this-class-is-visible-to-consumers-via-somemodule-somecomponent-but-is-not-e">question</a>. This explains how I fix it, but not why I need to put all components in the barrel file as the <a href="https://angular.io/api/core/NgModule#exports" rel="nofollow noreferrer">Angular documentation</a> for NgModules says:</p>
  <blockquote>
  <p>Exported declarations are the module's public API.</p>
  </blockquote>
  <p>Can someone explain this to me?</p>