Skip to content

EnvironmentData ​

Interface @vite-pwa/workbox-build/build

Properties ​

PropertyTypeDefaultDescription
baseUrl?string'/'The base url for the service worker web manifest entries build check.
bundlerLogLevel?BundlerLogLevelboth to 'warn'Granular control for underlying bundler logLevel.

If you set logLevel to 'silent then the underline bundler will also be silent.
chunkNames?"dash" | "dot"'dash'Specifies the separator style used for code splitting chunk names, assets, and entries. By default, Vite and Rolldown use the dash (-) separator:
- chunkFileNames: [name]-[hash].js
- assetFileNames: [name]-[hash].[ext]
- entryFileNames: [name]-[hash].js (Note: The main Service Worker entry won't include the -[hash])

Switching to dot (.) makes it easier to programmatically extract the [hash] from the filename (e.g., in backend environments). Enabling this changes the naming patterns to:
- chunkFileNames: [name].[hash].js
- assetFileNames: [name].[hash].[ext]
- entryFileNames: [name].[hash].js (Note: The main Service Worker entry won't include the .[hash])
define?Record<string, any>
envDir?string | false
envPrefix?string | string[]VITE_
logLevel?"info" | "silent"'info'
manifest?booleanfalseEnables the generation of the build manifest specifically for the Service Worker structure.

The manifest naming follows the same architectural strategy as the Service Worker assets:
- sw-manifest.json: When using a single Service Worker strategy or when workboxRuntimeCompatible is enabled.
- sw-manifest-classic.json: When using a dual Service Worker build for the classic variant, or when workboxRuntimeCompatible is disabled.
- sw-manifest-module.json: When using a dual Service Worker build for the module variant, or when workboxRuntimeCompatible is disabled.

The generated files will be emitted to the .vite-pwa subfolder within the build output directory, matching Vite's standard manifest structure (containing only file, name, src, isEntry, and imports).
mode?string | null"production"If set to 'production', then an optimized service worker bundle that excludes debugging info will be produced. If not explicitly configured here, the process.env.NODE_ENV value will be used, and failing that, it will fall back to 'production'.

Released under the MIT License.