Legacy JavaScript
What This Audit Checks
This audit scans your JavaScript bundles for patterns that indicate legacy transpilation: polyfills for features already supported by all modern browsers (like Array.prototype.includes or Object.assign), Babel-generated helper functions, and syntax downgraded to ES5 when ES2017+ would work. It estimates the bytes you could save by removing them.
Why It Matters
Legacy JavaScript bloats your bundles with code that no current browser needs. Polyfills for Promise, fetch, or Symbol are dead weight when your audience uses Chrome 80+, Safari 14+, or Firefox 78+. These extra bytes increase download time, extend parse and compile phases, and delay interactivity, all for zero benefit.
How to Fix It
- Set your Babel or TypeScript target to
es2017or higher. Avoid targetinges5unless you have confirmed IE11 traffic in your analytics. - Remove explicit polyfill imports (e.g.,
core-js,regenerator-runtime) that your bundler or framework may have added by default. Check yourbrowserslistconfig and set it to"> 0.5%, last 2 versions, not dead"or stricter. - Use the
module/nomodulepattern to serve modern bundles to capable browsers and legacy bundles only to the few that need them. - Audit your
node_modulesfor pre-compiled packages that ship their own polyfills. Prefer packages that publish ESM builds. - In Next.js, verify that your
next.config.jsdoes not force legacy browser support. Next.js automatically handles differential serving.
How Pulse Tracks This
Pulse runs the Lighthouse legacy JavaScript audit on every monitored page and reports the estimated byte savings. The Legacy JavaScript card highlights the specific polyfills and transforms detected so you can trace them back to your build config.