Skip to content
Nazmul Nikhil
Menu

Legacy JavaScript in PageSpeed Insights: Stop Shipping Old-Browser Code

PageSpeed flags polyfills and transpiled code that modern browsers don't need. Here's what causes it and how to target modern browsers in your build.

Nazmul Nikhil

By

Head of SEO & Assistant Manager, Digital Marketing at Notionhive

Published 1 min read
Legacy JavaScript in PageSpeed Insights: Stop Shipping Old-Browser Code
Photo: Umberto on Unsplash

In short

The Legacy JavaScript insight flags polyfills and code transformations for features every modern browser already supports. That code adds download size and parse time for nothing. Configure your build to target modern browsers, and update or replace plugins and libraries that bundle old polyfills.

This used to read "Avoid serving legacy JavaScript to modern browsers."

Replaced: legacy-javascript (same name, now an insight).

Where it comes from

Source Fix
Your build tool targets very old browsers Update the browserslist or build target (for example, Baseline "widely available")
Old libraries with bundled polyfills Update to current versions
Plugins or apps you don't control Update, replace, or accept the cost
Polyfill services loading everything Remove, or load only what's needed

WordPress, Shopify, Webflow and Wix: most flags come from themes, plugins and apps. Check which file is listed and whether a newer version exists. Custom builds: in Vite, the default build target is already modern; check for added legacy plugins. In Babel setups, update browserslist.

This guide isn't affiliated with or endorsed by Google.

Sources and references

TAGSPageSpeed InsightsLegacy javascript pagespeedAvoid serving legacy javascript to modern browsersPolyfills
Nazmul Nikhil

About the author

Nazmul Nikhil

Head of SEO & Assistant Manager, Digital Marketing at Notionhive

SEO and AI search consultant in Dhaka, Bangladesh, helping small and mid-size businesses in the USA, UK, Australia and Canada.

Need help with this?

Get it fixed with Core Web Vitals

I find the issues that cost you traffic and fix them, starting with the pages that matter most.

Keep reading

Related articles

All Page Speed & Core Web Vitals posts →

Get the next guide in your inbox

One email when a new SEO or AI search guide goes live.

Ready to grow?

Get a free audit of your website, or book a 30-minute call to talk through your goals.

Nazmul Hasan

Talk to Nazmul directly

Reply within 24h

WhatsApp +880 1682835118
nazmulnikhil@gmail.com