Skip to content

Commit

Permalink
fix: error when calling _generateBundle api
Browse files Browse the repository at this point in the history
  • Loading branch information
userquin committed Jul 12, 2022
1 parent 2366adc commit 5d4ae77
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ export async function _generateSW({ options, viteConfig }: PWAPluginContext) {
await generateServiceWorker(options, viteConfig)
}

export function _generateBundle({ options, viteConfig, useImportRegister }: PWAPluginContext, bundle: OutputBundle) {
if (options.disable)
return
export function _generateBundle({ options, viteConfig, useImportRegister }: PWAPluginContext, bundle?: OutputBundle) {
if (options.disable || !bundle)
return undefined

if (options.manifest) {
bundle[options.manifestFilename] = {
Expand Down Expand Up @@ -54,7 +54,7 @@ export function createAPI(ctx: PWAPluginContext): VitePluginPWAAPI {
return ctx?.options?.disable
},
generateBundle(bundle) {
return _generateBundle(ctx, bundle!)
return _generateBundle(ctx, bundle)
},
async generateSW() {
return await _generateSW(ctx)
Expand Down

0 comments on commit 5d4ae77

Please sign in to comment.