简体   繁体   English

检测到循环依赖项中的警告:barrelsby Angular 10

[英]WARNING in Circular dependency detected: barrelsby Angular 10

I am getting circular dependency warning while using barrelsby in Angular 10.在 Angular 10 中使用 bucketsby 时,我收到循环依赖警告。

Error: 
WARNING in Circular dependency detected:
src\app\core\components\components.module.ts -> src\app\core\components\header\header.component.ts -> src\app\state\index.ts -> src\app\core\components\components.module.ts

Structure:结构:

/component
  /header
    header.component.ts
    index.ts

index.ts

export * from './header.component';

component.module.ts

import { HeaderComponent } from './header';

@NgModule({
  imports: [],
  exports: [
    HeaderComponent,
  ],
  declarations: [
    HeaderComponent
  ]
})

index.ts

export * from './header/index';

It's just a warning so you don't absolutely need to fix it.这只是一个警告,因此您绝对不需要修复它。 The warning tells you where the circle is:警告会告诉您圆圈的位置:

  • module imports from header从头文件导入模块
  • header imports from index标头从索引导入
  • index imports from module从模块导入索引

In order to break the circle, I would avoid importing from index.为了打破这个圈子,我会避免从 index.html 导入。 Whichever component header is importing from index, import it from that components folder instead.无论哪个组件头是从 index 导入的,都从那个 components 文件夹中导入。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM