Performance
perf/no-legacy-javascript
Do not ship polyfills and down-level transforms for features your target browsers already support; declare targets once.
minorbrowserfe-perf-delivery
Why
Transpiling classes, async functions and optional chaining for browsers nobody uses makes bundles larger and slower to run, and polyfills for Baseline features are downloaded by every visitor.
Fix
Declare browser targets once (a browserslist query such as baseline widely available, or the bundler's build.target), drop blanket polyfill imports (core-js/stable in the entry), and add a polyfill only for a feature you use that is not in your targets. See fe-tooling for the configuration.
Examples
{ "browserslist": ["baseline widely available"] }Sources
Facts
- Id
perf/no-legacy-javascript- Severity
- minor
- Check
- browser needs a rendered page:
audit --url - Applies to
page- Same problem in
- Lighthouse
legacy-javascript-insight - Taught by the skill
fe-perf-deliveryJavaScript, CSS and asset delivery- Since version
- 0.1.0
Read it in the terminal
npx github:dawidolko/frontend-skills explain perf/no-legacy-javascript