angular - 此类通过 SomeModule -> SomeComponent 对消费者可见,但不会从顶级库入口点导出

标签 angular angular-library angular9

我将所有 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 , modulecomponent等在 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/

相关文章:

库中的 Angular 默认管道不起作用

angular - Webpack 生成 SCSS 源映射但不生成 JS

angular - 在 Angular 9 中迁移到 Jest 会出现 "Zone is not defined"错误

angular - NGXS 错误 : Can't resolve all parameters for TranslationEditorState: (? )

angular - 让 Angular Material 在 Angular 库中工作

css - 如何将全局样式添加到 Angular 6/7 库

Angular ionic : Property 'json' doesn't exist on type 'Object'

excel - 将元数据添加到 CSV 文件中以指示 Excel 应如何打开

angular 2 在 index.html 中引用外部 js 文件

angular - 如何在另一个表单构建器上的对象上设置值 - Typescript