Skip to content

defineCliOptions ​

Function workbox-cli
ts
defineCliOptions(strategy: S, options: Omit<WorkboxCliConfig<S, T>, "strategy">): WorkboxCliConfig<S, T>

Identity helper for authoring a typed workbox CLI config. Binds the config to a CliStrategy so options is type-checked and gets IntelliSense.

Example:

ts
// workbox.config.ts
import { defineCliOptions } from '@vite-pwa/workbox-cli'

export default defineCliOptions('generate-sw', {
  generateSW: { swDest: 'dist/sw.js', globDirectory: 'dist' },
})

Released under the MIT License.