Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: error when calling _generateBundle api #334

Merged
merged 2 commits into from
Jul 13, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ export async function _generateSW({ options, viteConfig }: PWAPluginContext) {
await generateServiceWorker(options, viteConfig)
}

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

if (options.manifest) {
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