Skip to content

rwv/workbox-mirror-precache-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📦 workbox-mirror-precache-plugin

A workbox plugin that fetch precache files from various mirrors.

GitHub Workflow Status npm NPM

Usage

npm install workbox-mirror-precache-plugin
import { addPlugins } from "workbox-precaching";
import { cacheNames } from "workbox-core";
import { MirrorPrecachePlugin } from "workbox-mirror-precache-plugin";

const cacheName = cacheNames.precache;
const entries = self.__WB_MANIFEST;
const mirrors = [
  "https://cdn.example.com",
];

addPlugins([
  new MirrorPrecachePlugin({
    entries,
    cacheName,
    prefixs: [self.origin, ...mirrors],
  }),
]);
precacheAndRoute(entries);

License

MIT