vite-plugin-inject-sw-assets
Version:
A Vite plugin that injects static assets into a custom service worker for use with injectManifest (ideal for Workbox + vite-plugin-pwa setups).
10 lines (9 loc) • 536 B
TypeScript
/**
* Writes a JavaScript file that defines a global variable with the list of assets to precache.
* This file is intended to be imported or referenced by the service worker.
*
* @param {string} filePath - The path where the output file should be written (e.g., "dist/sw-assets.js")
* @param {AssetEntry[]} assets - The list of assets to inject, each with a `url` and optional `revision`
*/
import type { AssetEntry } from '../types';
export declare function writeInjectedAssetsFile(filePath: string, assets: AssetEntry[]): void;