Read the business case closely and you notice that most of the gains came from speed: Pinterest cut its JavaScript bundle and time to interactive; Tinder and Uber built tiny shells that load on 2G. A service worker makes repeat visits fast, but the first visit is still up to you.
Targets (Core Web Vitals)
| Metric | Good | What it measures |
|---|---|---|
| Largest Contentful Paint (LCP) | 2.5 s or less | When the main content appears |
| Interaction to Next Paint (INP) | 200 ms or less | How quickly the page responds to taps and keys |
| Cumulative Layout Shift (CLS) | 0.1 or less | How much the layout jumps |
Measure on a mid-range Android phone on 4G, not on your laptop.
The app shell
Split the UI into a minimal shell (header, navigation, layout, styles) and content. Precache the shell in the service worker so it appears instantly on repeat visits, then fill in content from cache or network. For content sites, server-rendered HTML with a network-first strategy gives the same effect with less complexity.
Ship less JavaScript
- Server-render or prerender pages; hydrate only interactive islands.
- Split code by route; load heavy features on demand.
- Audit dependencies: date libraries, icon packs and UI kits are common culprits.
- Avoid shipping polyfills to modern browsers.
Images and fonts
- Use AVIF or WebP with
srcsetandsizes; setwidthandheightto avoid layout shift. loading="lazy"below the fold;fetchpriority="high"on the hero image.- Two font families at most,
font-display: swap, and subset where you can.
Use the service worker well
- Precache only the shell; cache the rest at runtime (strategies).
- Enable navigation preload.
- Do not intercept requests you do not need to.
Prerender likely next pages
The Speculation Rules API (Chromium) can prefetch or prerender the next page before the user clicks:
<script type="speculationrules">
{ "prerender": [{ "where": { "href_matches": "/learn/*" }, "eagerness": "moderate" }] }
</script>
Measure in the field
Use the web-vitals library to send real-user metrics to your analytics, split by display-mode so you can compare installed and browser users.