我将所有 Angular 库升级到 angular 9.0.0
使用 ng update
当我尝试构建它们时,出现以下错误。
错误:
Unsupported private class SomeComponent. This class is visible to consumers via SomeModule -> SomeComponent, but is not exported from the top-level library entrypoint.
有人解决了这个错误吗?
最佳答案
如果在 NgModule
中导出任何组件,则会发生此错误并且不包含在您的 public_api.ts
中, Angular 9
现在会抛出错误。
这个错误不是来自 Angular 8
但升级到 Angular 9
后它开始显示。
如果您导出了任何 service
, module
或 component
等在 NgModule
确保将它们包含在 public_api.ts
中否则 angular 9
现在会抛出错误。
修复:将您的组件添加到 public_api.ts
export * from './lib/components/some-me/some-me.component';
关于angular - 此类通过 SomeModule -> SomeComponent 对消费者可见,但不会从顶级库入口点导出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60121962/