English
ResolvedVitePWAOptions
Properties
| Property | Type | Default | Description |
|---|---|---|---|
additionalManifestEntries | string | ManifestEntry[] | A list of entries to be precached, in addition to any entries that are generated as part of the build configuration. | |
additionalManifestEntriesGenerator | () => AsyncGenerator<string | ManifestEntry, undefined, void> | Async generator that yields additional entries to be preached. | |
base | string | "base" options from Vite or the corresponding bundler or framework integration. | The base for your app. |
buildBase | string | | When Vite's build folder is not the same as your base root folder, configure it here. This option will be useful for integrations like vite-plugin-laravel where Vite's build folder is public/build but Laravel's base path is public.This option will be used to configure the path for the service worker, registerSW.js and the web manifest assets.For example, if your base path is /, then, in your Laravel PWA configuration use buildPath: '/build/'. |
buildSW | ResolvedBuildSW<S, T> | The workbox object for buildSW strategy | |
cwd | string | process.cwd() | Current working directory to load external configuration options. |
devOptions | DevOptions | Development options. | |
disable | boolean | false | Disable service worker registration and generation on build? |
generateSW | ResolvedGenerateSW<S, T> | The workbox object for generateSW strategy | |
includeAssets | string | string[] | undefined | public resources to be added to the PWA manifest.You don't need to add manifest icons here, it will be auto included.The public directory will be resolved from Vite's publicDir option directory. | |
includeManifest | boolean | true | By default, the manifest will be included on the service worker *precache* manifest. |
includeManifestIcons | boolean | true | By default, the icons listed on manifest option will be included on the service worker *precache* if present under Vite's publicDir option directory. |
includeManifestScreenshots | boolean | false | By default, the screenshots listed on manifest option won't be included on the service worker *precache* if present under Vite's publicDir option directory. |
includeManifestShortcutIcons | boolean | true | By default, the shortcut icons listed on manifest option will be included on the service worker *precache* if present under Vite's publicDir option directory. |
injectManifest | ResolvedInjectManifest<S, T> | The workbox object for injectManifest strategy | |
injectRegister | false | "inline" | "script" | "script-defer" | "auto" | null | 'auto' | 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 modeinline - inject a simple register, inlined with the generated htmlscript - inject <script/> in <head> with src attribute to a generated script to register the service workerscript-defer - inject <script defer /> in <head>, with src attribute to a generated script to register the service workernull - deprecated, use false insteadfalse - do nothing, you will need to register the sw you self, or imports from virtual:pwa-register |
manifest | false | Partial<ManifestOptions> | The manifest object | |
manifestFilename | string | 'manifest.webmanifest' | |
mergeOptions | boolean | false | When path is specified, should merge inlined options and the configuration?NOTE: inlined options will override external configuration options. |
minify | boolean | Should minify the output? - when specified it is preserved - true when sourcemap is not set to false or mode is set to production - otherwise false | |
outDir | string | 'dist' | |
path | string | path to load external configuration options:- can be an absolute path - can be a relative path, which will be resolved relative to cwd (or process.cwd() if cwd is not specified) | |
pwaAssets? | ResolvedPWAAssetsOptions | ||
registerType | "prompt" | "autoUpdate" | 'prompt' | Mode for the virtual register. Is NOT available for strategy injectRegister, only use for strategy generateSWprompt - you will need to show a popup/dialog to the user to confirm the reload.autoUpdate - when new content is available, the new service worker will update caches and reload all browser windows/tabs with the application open automatically, it must take the control for the application to work properly. |
scope | string | same as | The scope to register the Service Worker |
selfDestroying | SelfDestroyingOptions | The workbox object for selfDestroying strategy. | |
strategy | S | ||
swDest | string | ||
swSrc | string | ||
swType | T | Service worker type. | |
updateViaCache | ServiceWorkerUpdateViaCache | The update via cache | |
useCredentials | boolean | false | Whether to add the crossorigin="use-credentials" attribute to <link rel="manifest"> |