devtools icon indicating copy to clipboard operation
devtools copied to clipboard

feat(components): shortcut to find unused components

Open TheAlexLichter opened this issue 2 years ago â€ĸ 9 comments
trafficstars

🆒 Your use case

In bigger projects and after refactoring/new features, having an overview which of the hundred components are still in use is not always given. Thus, it'd be amazing to figure that out through the devtools and the component tab.

🆕 The solution you'd like

In the component tab, having an option to list only unused components. There might be caveats with dynamic imports or similar (not sure?) but eventually, that could be shown as warning.

🔍 Alternatives you've considered

No response

â„šī¸ Additional info

Happy to also work on the feature if people are interested in it

TheAlexLichter avatar Aug 02 '23 23:08 TheAlexLichter

Does this work at all? It shows hundreds of unused components for me but I'm pretty sure they are used. Maybe It only shows as used if I'm on the same page? @antfu

metkm avatar Dec 23 '23 10:12 metkm

@metkm I think this worked for me in the past but recently it only shows components not used on the current page indeed.

TheAlexLichter avatar Dec 23 '23 13:12 TheAlexLichter

We will need to add a button like "Scan components for all routes" to allow users to bring the behavior back manually.

TheAlexLichter avatar Feb 08 '24 16:02 TheAlexLichter

This sounds pretty useful !

davidparys avatar Feb 23 '24 20:02 davidparys

I was thinking about having this feature, and I see that there is already a proposal.

I can only add that the same thing could be done also for composables, under the same exact reasoning.

Thanks by the way!

stefanobartoletti avatar Apr 05 '24 10:04 stefanobartoletti

Sounds like an analyzer to run at buildtime.Will be interested too.

kogratte avatar Apr 09 '24 14:04 kogratte

This would be amazing to have fixed again! I am trying to clean up a large Nuxt codebase with lots of dead components, and having a list of all the unused components would help a bunch.

sifferhans avatar Apr 11 '24 12:04 sifferhans

This would definitely be very useful

fabis94 avatar Apr 19 '24 11:04 fabis94

@TheAlexLichter thank you for amazing idea.

Also, I think there must be a function to ignore some components from the list. Let say I have UI components and I know I will use them in the future. But other components can be safely removed.

chz avatar Feb 12 '25 11:02 chz