Performance · Concept
Lighthouse PWA audits
Published
In one line: Per Chrome for Developers, Lighthouse is an open-source, automated tool that runs a series of audits against a URL and reports how well the page performed, with audits for performance, accessibility, SEO, and more. Its PWA category is no longer part of that report: per the Chrome blog post on revisiting the installability criteria, the Lighthouse PWA checks were directly associated with those criteria, so Chrome decided to remove the category from Lighthouse.
Where it is supported
Section titled “Where it is supported”Per Chrome for Developers, you can run Lighthouse in Chrome DevTools, from the command line, as a Node module, or from a web UI — and the CLI and Node workflows require an instance of Google Chrome installed on your machine. In DevTools, Lighthouse has its own panel: open the page you want to audit, open the Lighthouse tab, and run the audit.
Run an audit from the command line
Section titled “Run an audit from the command line”Per Chrome for Developers, the Node module is installed globally with the -g flag and
then pointed at a URL, and lighthouse --help lists all the options:
npm install -g lighthouselighthouse https://example.comlighthouse --helpPer Chrome for Developers, you can also use Lighthouse CI to prevent regressions on your sites.
Detect installability in the page instead
Section titled “Detect installability in the page instead”With the PWA category gone, the runtime signal that a browser considers the page
installable is the beforeinstallprompt event. Per MDN, it fires when the browser has
detected that a website can be installed as a Progressive Web App, and the typical use is
to reveal your own in-app installation UI — which, per MDN, should be hidden by default,
because not all browsers support installation. Per MDN, the handler keeps a reference to
the BeforeInstallPromptEvent and calls its prompt() method when the user acts on that
UI:
const installButton = document.querySelector('#install');
if ('onbeforeinstallprompt' in window) { window.addEventListener('beforeinstallprompt', (event) => { installButton.hidden = false; installButton.addEventListener('click', () => event.prompt(), { once: true }); });} else { // No support for the event: leave the in-app install UI hidden and let the // browser offer whatever install affordance it has of its own accord. installButton.hidden = true;}Practical checklist
Section titled “Practical checklist”- Do not build a workflow on the PWA audits. Per the Lighthouse audit reference, PWA testing in Lighthouse is deprecated, and per the Chrome blog post the category was removed — a score you remember from an older report is not something the current tool still produces.
- Use DevTools for installability instead. Per the Chrome blog post, the checks for optimizations and debugging for installable experiences are still available in DevTools.
- The old service-worker requirement moved. Per the Chrome blog post, Chrome removed
the requirement to have a service worker implementing
fetch()in order to install from the menu, since version 108 on mobile and 112 on desktop; the blog post states that the algorithm displaying the install prompt still required the presence of afetch()handler at the time of writing. A cached mental model of “no fetch handler, no install” is no longer accurate for the menu path. - Service workers still matter. Per the Chrome blog post, they remain a core web technology, necessary for experiences such as a good cache strategy, notifications and custom offline experiences — the criteria change is not a reason to drop yours.
beforeinstallpromptis not a portable test. Per MDN, it has limited availability and is not Baseline, so treat its absence as “this browser does not offer this hook”, not as “this page is not installable”.- The CLI needs a browser. Per Chrome for Developers, the CLI and Node workflows require you to have an instance of Google Chrome installed on your machine.
Where to go next
Section titled “Where to go next”- Installability criteria — what a browser actually requires before it offers to install a page.
- Install prompt — the event above, covered as its own reference entry.
- Core Web Vitals — a separate performance reference on this site.
Specifications
| Specification | Status |
|---|---|
| None. | |