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).
11 lines (10 loc) • 590 B
TypeScript
/**
* Scans the output directory for static assets to be injected into the service worker.
*
* @param {string} distDir - The build output directory to scan (e.g., "dist")
* @param {string[]} extensions - List of file extensions to include (e.g., ["png", "json"])
* @param {string[]} excluded - List of file URLs to exclude (e.g., icons from manifest)
* @returns {AssetEntry[]} - List of asset entries with `url` and `revision`
*/
import type { AssetEntry } from '../types';
export declare function scanAssets(distDir: string, extensions: string[], excluded: string[]): AssetEntry[];