import { Plugin } from 'vite'; import { InjectManifestOptions, GenerateSWOptions, ManifestEntry, RuntimeCaching } from 'workbox-build'; import { OutputBundle } from 'rollup'; declare type InjectManifestVitePlugins = string[] | ((vitePluginIds: string[]) => string[]); declare type CustomInjectManifestOptions = InjectManifestOptions & { /** * `Vite` plugin ids to use on `Rollup` build. * * **WARN**: this option is for advanced usage, beware, you can break the service worker build. */ vitePlugins?: InjectManifestVitePlugins; }; /** * Plugin options. */ interface VitePWAOptions { /** * Build mode * * @default process.env.NODE_ENV or "production" */ mode?: 'development' | 'production'; /** * @default 'public' */ srcDir?: string; /** * @default 'dist' */ outDir?: string; /** * @default 'sw.js' */ filename?: string; /** * @default 'manifest.webmanifest' */ manifestFilename?: string; /** * @default 'generateSW' */ strategies?: 'generateSW' | 'injectManifest'; /** * The scope to register the Service Worker * * @default same as `base` of Vite's config */ scope?: string; /** * Inject the service worker register inlined in the index.html * * With `auto` set, depends on whether you used the `import { registerSW } from 'virtual:pwa-register'` * it will do nothing or use the `script` mode * * `inline` - inject a simple register, inlined with the generated html * * `script` - inject