DEV Community

Discussion on: 𝗛𝗼𝘄 𝘁𝗼 𝗳𝗶𝗻𝗱 "UNUSED' 𝗝𝗔𝗩𝗔𝗦𝗖𝗥𝗜𝗣𝗧 𝗮𝗻𝗱 𝗖𝗦𝗦 𝗰𝗼𝗱𝗲 𝗼𝗻 𝘆𝗼𝘂𝗿 𝗽𝗮𝗴𝗲? 🤔

Collapse
 
vishalraj82 profile image
Vishal Raj

@varunprashar5 Does not seems very optimized way to find used code. Linters can do better job.

Collapse
 
salmin profile image
Salmin Skenderovic

The advantage of using this tool would be that you can do a page-refresh on a single page and see how much that specific page can gain from code-splitting and lazy loading.

Collapse
 
varunprashar5 profile image
varunprashar5

Exactly 100% correct. So your 10 MB bundle will not be required on your home screen but may be only 100 KB.

Thread Thread
 
vishalraj82 profile image
Vishal Raj

Then why not split the code in such a way in first place only.

Thread Thread
 
varunprashar5 profile image
varunprashar5

This can not realistic to be done in first place. You will first diagnose and then act on it. Thats why refactoring phase is there.

Collapse
 
varunprashar5 profile image
varunprashar5

Then you have not understood the concept properly. It is not like "variable is delcared but not defined."

It is saying that you current page actually requires 20% of the code but is actually loading 100%.
So what you can do is lazily load few modules based on the user events which will give faster initial loads to your application.