GoogleChrome / GoogleChrome/lighthouse
Add `fetch` polyfill detection to Legacy javascript audit
- Dominant language
- JavaScript
- Stars
- 30.8k
- Forks
- 9.8k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 20
Description
**Feature request summary**
the `LegacyJavascript` audit currently checks for `core-js` polyfills.
https://github.com/GoogleChrome/lighthouse/blob/master/lighthouse-core/audits/legacy-javascript.js#L166-L245
I assume they are aimed at finding stuff no long needed in `script type=module` compatible browsers.
While that list is pretty exhaustive it misses `fetch`.
Fetch could be shipped by
`https://polyfill.io/v3/polyfill.min.js?features=fetch`
or
`https://www.npmjs.com/package/isomorphic-fetch`
or
`https://github.com/github/fetch`
etc
**What is the motivation or use case for changing this?**
Completness of the feature set for detecting legacy javascript.
**How is this beneficial to Lighthouse?**
It calls out the unnecessary bytes shipped to the browser which doesnt require the polyfill.
Contributor guide
Research direction
Start in lighthouse-core/audits/legacy-javascript.js around lines 166-245 and review how the existing core-js polyfill checks identify legacy code. Extend the audit's coverage to the fetch polyfill sources described in the issue, with completion shown by fetch polyfills being detected and their unnecessary bytes reported.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- performance
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100