Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better error message when module imports itself #14644

Closed
ScallyGames opened this issue Feb 22, 2017 · 1 comment · Fixed by #14646
Closed

Better error message when module imports itself #14644

ScallyGames opened this issue Feb 22, 2017 · 1 comment · Fixed by #14646

Comments

@ScallyGames
Copy link

I'm submitting a ... (check one with "x")

[ ] bug report => search github for a similar issue or PR before submitting
[x] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior

When a module imports itself a generic
Uncaught RangeError: Maximum call stack size exceeded
is thrown which could have a whole bunch of reasons.

Expected behavior

It would be really nice if Angular could detect self-imports (maybe even circular imports if that's a thing) and show a more helpful error message to spare developers the time of debugging.

Minimal reproduction of the problem with instructions

http://plnkr.co/edit/hD9KHmgNKgiNYwXCUYp4

Run and check the console.
Removing AppModule from AppModule's imports resolves the problem.

What is the motivation / use case for changing the behavior?

Cause could be a developers mistake, wrong entry of autocomplete (many IDEs offer it as an option since the class is in scope) or even refactoring gone wrong (which would possibly cause hours of debugging, searching for self-generated loops in functions etc.), ...

Best clue when searching on the internet is this content, which is not even really related to the issue topic
#7930 (comment)

  • Angular version: 2.4.8
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant