Performance
How to reduce JavaScript on a page
Measure what is actually shipping with the Coverage panel, remove libraries used for one feature, defer everything non-critical, and question whether the page needs a framework at all. Most marketing pages need almost no JavaScript.
Before you start
- Access to the build
- Chrome DevTools
The steps
-
Step 1: Open the Coverage panel
DevTools → ⌘⇧P / Ctrl+Shift+P → "Show Coverage" → reload. It reports how much of each file was actually used.
-
Step 2: Note the unused percentage
Anything above 60% unused is a candidate for removal or code splitting.
-
Step 3: List every third-party script
Analytics, chat widgets, heatmaps, A/B tools, social embeds. Each has a cost and an owner who is not you.
-
Step 4: Remove what nobody reads
A heatmap tool nobody has opened in six months is pure cost.
-
Step 5: Replace single-purpose libraries
A date library for one format call, or jQuery for one selector, can usually go.
-
Step 6: Defer the rest
defer or async on everything not needed for first paint. Load chat widgets on interaction rather than on load.
-
Step 7: Question the framework
A brochure site rendered client-side ships a framework to display text. Static generation ships the text.
-
Step 8: Re-measure with Coverage
And confirm the page still works with JavaScript disabled if it is content.
The metric it moves
Interaction to Next Paint. Every script competes for the main thread, and a busy main thread is exactly why a tap feels slow. Removing JavaScript is the most direct way to improve INP.
The test that settles the argument
Disable JavaScript and reload. If the content vanishes, you are shipping a framework to display text that could have been in the HTML — and every non-rendering crawler sees the blank version.
The background behind this
Core Web Vitals, and the order that actually reduces them covers the reasoning in about 3 minutes — free, ungated, written from client work.
Who wrote this
Anas Bin Masud builds e-commerce sites and does technical SEO for businesses in the UK, Canada, Ireland and Pakistan. These procedures are the ones I run on client work, written down rather than invented — including the ones where the honest answer is that the fix is not available on your current hosting.