消费者可以通过SomeModule->看到此类.SomeComponent,但不是从顶级库入口点导出的 [英] This class is visible to consumers via SomeModule -> SomeComponent, but is not exported from the top-level library entrypoint
问题描述
我使用 ng update
将我所有的角度库升级到了 angular 9.0.0
,当我尝试构建它们时,出现了以下错误.
I upgraded all my angular library to angular 9.0.0
using ng update
and when I try to build them I got below error.
错误:
不受支持的私有类SomeComponent.消费者可以通过SomeModule-> SomeComponent看到此类,但不会从顶级库入口点导出.
Unsupported private class SomeComponent. This class is visible to consumers via SomeModule -> SomeComponent, but is not exported from the top-level library entrypoint.
有人解决了这个错误吗?
Anyone solved this error?
推荐答案
如果将任何组件导出到 NgModule
中且未包含在 public_api.ts
中,则会发生此错误,角度9
现在会出错.
This error happens if any component is exported in NgModule
and not included in your public_api.ts
, angular 9
will through error now.
此错误不是在 angular 8
中出现的,但是在升级到 angular 9
之后,它开始显示.
This error was not coming in angular 8
but after upgrading to angular 9
it started showing.
如果在 NgModule
中导出了任何 service
, module
或 component
等,请确保将它们包括在 public_api.ts
或 angular 9
现在会引发错误.
If you exported any service
, module
or component
, etc in NgModule
make sure to include them in public_api.ts
or else angular 9
will throw error now.
修复:将您的组件添加到 public_api.ts
Fix: add your component to the public_api.ts
export * from './lib/components/some-me/some-me.component';
这篇关于消费者可以通过SomeModule->看到此类.SomeComponent,但不是从顶级库入口点导出的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!