https://github.com/rwv/workbox-mirror-precache-plugin
📦 A workbox plugin that fetch precache files from various mirrors.
https://github.com/rwv/workbox-mirror-precache-plugin
precache service-worker workbox
Last synced: 12 days ago
JSON representation
📦 A workbox plugin that fetch precache files from various mirrors.
- Host: GitHub
- URL: https://github.com/rwv/workbox-mirror-precache-plugin
- Owner: rwv
- License: mit
- Created: 2023-12-06T08:00:26.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2025-01-13T19:27:55.000Z (about 1 year ago)
- Last Synced: 2025-10-31T22:47:53.544Z (4 months ago)
- Topics: precache, service-worker, workbox
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/workbox-mirror-precache-plugin
- Size: 44.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# 📦 workbox-mirror-precache-plugin
A workbox plugin that fetch precache files from various mirrors.
[](https://github.com/rwv/workbox-mirror-precache-plugin/actions/workflows/build.yml)
[](https://www.npmjs.com/package/workbox-mirror-precache-plugin)

## Usage
``` bash
npm install workbox-mirror-precache-plugin
```
``` ts
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