Esta página ainda não está disponível em Português, por isso está a ler a versão em inglês.

Workbox

A set of libraries for service workers: precaching with revision hashes, routing, caching strategies, expiration, background sync and a window helper for updates.

★ Escolha do PWA.live: é por onde começaríamos.

A set of libraries for service workers: precaching with revision hashes, routing, caching strategies, expiration, background sync and a window helper for updates. Many build tools and frameworks use it underneath.

When to use it

You want proven, well-documented building blocks for a service worker, or your build tool (webpack, Vite via vite-plugin-pwa, Workbox CLI) already generates one with it.

Get started

npm i -D workbox-cli && npx workbox-cli wizard
import { registerRoute } from 'workbox-routing';
import { NetworkFirst } from 'workbox-strategies';
registerRoute(({ request }) => request.mode === 'navigate', new NetworkFirst({ cacheName: 'pages' }));

Source code, issues and documentation: github.com/GoogleChrome/workbox.