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.
Related issues
Sources and references
Chrome for Developers, Legacy JavaScript
web.dev, Baseline

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.



