[Feature] Highlight the module which is imported/used duplicately.
See original GitHub issueHey 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.
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
- 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?
- How to represent if we have many different duplicate modules. Use different colors ? Maybe a list or table is better ?
Any thoughts or suggestion are welcome. Thanks
Issue Analytics
- State:
- Created 4 years ago
- Reactions:5
- Comments:5 (3 by maintainers)
I’ll reopen this issue as a reminder.
Well, I had thoughts about it. Maybe we’ll come back to it a little later after implementing a few other important features e.g. import reasons.
P.S. This duplication logic can be tuned with
optimization.splitChunks
webpack config option: https://webpack.js.org/plugins/split-chunks-plugin/An important quotes from there:
So, as @valscion said, module duplication it not necessary a problem at all.