Skip to content

Commit

Permalink
chore: deprecate null inject register value (#662)
Browse files Browse the repository at this point in the history
* chore: deprecate `null` inject register value

* chore: update usage
  • Loading branch information
userquin committed Feb 15, 2024
1 parent aaa856b commit ffeacf9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export function _generateBundle({ options, viteConfig, useImportRegister }: PWAP

// if virtual register is requested, do not inject.
if (options.injectRegister === 'auto')
options.injectRegister = useImportRegister ? null : 'script'
options.injectRegister = useImportRegister ? false : 'script'

if ((options.injectRegister === 'script' || options.injectRegister === 'script-defer') && !existsSync(resolve(viteConfig.publicDir, FILE_SW_REGISTER))) {
bundle[FILE_SW_REGISTER] = {
Expand Down
4 changes: 3 additions & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,9 @@ export interface VitePWAOptions {
*
* `script-defer` - inject `<script defer />` in `<head>`, with `src` attribute to a generated script to register the service worker
*
* `null` - do nothing, you will need to register the sw you self, or imports from `virtual:pwa-register`
* `null` - deprecated, use `false` instead
*
* `false` - do nothing, you will need to register the sw you self, or imports from `virtual:pwa-register`
*
* @default 'auto'
*/
Expand Down

0 comments on commit ffeacf9

Please sign in to comment.