繁体   English   中英

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

[英]WARNING in Circular dependency detected: barrelsby 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

结构:

/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';

这只是一个警告,因此您绝对不需要修复它。 警告会告诉您圆圈的位置:

  • 从头文件导入模块
  • 标头从索引导入
  • 从模块导入索引

为了打破这个圈子,我会避免从 index.html 导入。 无论哪个组件头是从 index 导入的,都从那个 components 文件夹中导入。

暂无
暂无

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

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