question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Barrel and Circular dependency

See original GitHub issue
- [ ] bug report -> please search issues before submitting
- [ x ] feature request

Versions.

@angular/cli: 1.3.0
node: 6.11.0
os: linux x64
@angular/animations: 4.3.4
@angular/common: 4.3.4
@angular/compiler: 4.3.4
@angular/core: 4.3.4
@angular/flex-layout: 2.0.0-beta.8
@angular/forms: 4.3.4
@angular/http: 4.3.4
@angular/material: 2.0.0-beta.8
@angular/cdk: 2.0.0-beta.8
@angular/platform-browser: 4.3.4
@angular/platform-browser-dynamic: 4.3.4
@angular/router: 4.3.4
@angular/cli: 1.3.0
@angular/compiler-cli: 4.3.4
@angular/language-service: 4.3.4

Repro steps.

The following will generate circular deps warning between a.compoentnt.ts -> index.ts -> a.component.ts

module/
|- a.component.ts
|- b.model.ts
|- index.ts

a.compoennt.ts:

import {B} from '.'

b.component.ts

export class B { }

index.ts

export * from './b.model.ts';
export * from './a.component.ts';

Desired functionality.

An option to ignore these kind of circular deps A => barrel => A

Circular deps check is great (I was able to find real ones), and I would like to keep this option always on, but its too noisy with barrels.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:13 (1 by maintainers)

github_iconTop GitHub Comments

11reactions
guilhermejcgoiscommented, Aug 14, 2017

Just don’t import from the barrels, import from the stuff1.service itself…

10reactions
Socolincommented, Aug 15, 2017

Barrels works great when you have multiple module.

Simple rule: Do not import a symbol from a barrel that export the current file.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Circular Dependency - A progressive Node.js framework
Warning A circular dependency might also be caused when using "barrel files"/index.ts files to group imports. Barrel files should be omitted when it...
Read more >
Barrel files: to use or not to use? - Blog by Adrian Fâciu
We just don't want to have too many barrel files since that is counter productive and usually leads to circular dependency issues which ......
Read more >
Use directory import (barrel file) only if it's outside the current ...
Use directory import (barrel file) only if it's outside the current path — to avoid circular dependency in some build systems.
Read more >
WARNING in Circular dependency detected - Stack Overflow
I am getting circular dependency warning while using barrelsby in Angular 10. Error: WARNING in Circular dependency detected: ...
Read more >
How to fix nasty circular dependency issues once and for all in ...
The module loading order in JavaScript is deterministic. Yet it is not very easy to follow in large projects. The reason for this,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found