Skip to content

[Feature] Highlight the module which is imported/used duplicately. #315

@gaokun

Description

@gaokun

Hey Guys,
I wanna discuss a new feature about module imported/used duplicately.

Actually, I have been working on project optimization for days.
I wanna decrease webpack bundle size, make it fast to load.

So I have looked into the diagram from webpack-bundle-analyzer for hundred times in those days.
This is a great plugin, many thanks to team.

Scenario

In modern web framework like Angular, React, Vue, they all support dynamic routing.
And if we use static import to import same module in some dynamical routers, we may make the bundles "dirty".

As you see below, common.ts is imported twice.

static import & dynamic import.

image

What I want

For web developer beginners, they have no idea about what kind of bundles they will get in different way of coding.
We have many web developers in company, so I wanna to know: Is there a same problem in my project?

We could imagine if webpack-bundle-analyzer can represent it (highlight them in red or sth.) to us, that would be great!

Not all duplicate modules need to be extracted as individual.
Maybe we can bundle it into main module (app.js), it depends on business and module size etc.

Questions need to discuss

  1. main module (app.js) may take the most area of diagram. It is hard to find duplicate modules. After hiding main module, it better. Do we need to make a new diagram or component for this?
  2. How to represent if we have many different duplicate modules. Use different colors ? Maybe a list or table is better ?

webpack-bundle-analyzer

Any thoughts or suggestion are welcome.
Thanks

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions