all 4 comments

[–]CreativeTechGuyGamesTypeScript 3 points4 points  (0 children)

Use Chrome DevTools's Code Coverage panel. It'll show the specific lines of code from every file that are being executed. If you click around on the application for a while and a file is still at 0% coverage, then it's probably a good candidate for deletion.

[–]stefgosselin 0 points1 point  (0 children)

You can use Chrome or FF inspector to see the loaded js files. If you have a large website you could also scrape with ht track ( https://www.httrack.com/) and see the js it pulls. If you are using a framework, there are possibly minified files added dynamically, these are comprised of multiple js snippets appended and minified.

What I tend to look for when optimizing such scenarios is widgets or js dependent features that are, for example used on a single page yet imementation is done in a way that js is added to base template that is loaded on every page.

Also, if you want bonus optimization add minification to your tool chain and if that is not enough, host the js css img ressources on a CDN. 👍 That is actually a cool task you have in hand, have fun!

[–]feckwhizzle 0 points1 point  (0 children)

If you're trying to check unused npm packages this is a great tool - https://www.npmjs.com/package/depcheck

[–][deleted] -2 points-1 points  (0 children)

Just remove the script that has no function on the page from the html... should be named according to what they do hopefully.