Skip to content

Give feedback on unused modules in the application #43427

Closed

Description

@ertunga

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

No response

Description

Angular should give feedback on unused/unnecessary modules imported into the application modules.

It is very easy to forget to remove (or mistakenly add) unused modules into an Angular application. This might be a material component module that's never been used or an application module imported into your app.module without using anything from it. Angular should provide some sort of feedback to the developer, giving information about any unused modules in the application. The feedback might be in the form of a squiggly line or a warning in the devtools, visible during development.

I am aware that build optimizer optimizes the bundle and tree-shakes anything that is not being used, but there is still benefit in providing feedback.

  1. Developers would get a better understanding of using modules correctly, what needs to be in the module and what is not.
  2. It is better to not include stuff you don't need in the first place, than trusting the optimizer will optimize everything for you. (What if there is a scenario where the optimizer fails to tree-shake)

Proposed solution

Any feedback that informs developers is welcome. It could be a squiggly line under the unused modules or a warning in the devtools. It should not prevent the compilation.

Alternatives considered

Activity

  1. added
    area: compiler
    feature
    on Sep 11, 2021
  2. modified the milestone: Backlog on Sep 11, 2021
  3. Airblader commented on Sep 11, 2021

    @Airblader
    Contributor

    Duplicate of #41028

  4. angular-robot commented on Sep 12, 2021

    @angular-robot
    Contributor

    This feature request is now candidate for our backlog! In the next phase, the community has 60 days to upvote. If the request receives more than 20 upvotes, we'll move it to our consideration list.

    You can find more details about the feature request process in our documentation.

  5. added
    feature: under consideration
    and removed on Sep 13, 2021
  6. JoostK commented on Sep 13, 2021

    @JoostK
    Member

    Duplicate of #41028 (I have changed the voting labels accordingly).

  7. angular-automatic-lock-bot commented on Oct 14, 2021

    @angular-automatic-lock-bot

    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.

  8. locked and limited conversation to collaborators on Oct 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: compilerfeaturefeature: under consideration

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions