angular / angular/angular

Please report about circular dependencies of standalone components on "build" step

Open
#48,976 15 comments 13 reactions 0 assignees View on GitHub
area: compiler area: core cross-cutting: standalone feature
Dominant language
TypeScript
Stars
101k
Forks
27.5k
Avg merge
1d 19h
Merged PRs (30d)
288

Description

### Which @angular/* package(s) are relevant/related to the feature request?

compiler

### Description

If standalone component A imports standalone component B, and B imports A, then `ReferenceError: Cannot access 'A' before initialization` will be raised.
But it will be only raised in runtime 🤷‍♂️

### Proposed solution

Please do not allow to compile components with circular dependencies.

### Alternatives considered

Or, allow circular dependencies 😜

Contributor guide

Open the contributing guide

Research direction

Start in the @angular/compiler handling of standalone-component imports during the build step, using the reported A/B circular-import scenario as the reproduction. Done means the compiler reports circular dependencies during build rather than allowing the runtime ReferenceError, or the issue's requested alternative is explicitly addressed.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
compilers
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.