Skip to content

Commit

Permalink
Refactor console log output
Browse files Browse the repository at this point in the history
  • Loading branch information
ivandotv committed Jun 14, 2022
1 parent 31d6e32 commit 64ab202
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .changeset/few-rice-try.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"nextjs-workbox-config": patch
---

Refactor console log output
14 changes: 7 additions & 7 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,22 @@ export function withWorkbox(
return config
}
if (!wbConfig.swSrc) {
throw new Error('service worker path missing')
throw new Error('Workbox: service worker "path" is missing')
}

if (wbConfig.disable) {
console.log('> Progressive web app is disabled')
console.log('Workbox: service worker is disabled')

return config
}

const swSrcPath = path.join(options.dir, wbConfig.swSrc)

console.log(`Workbox: service worker source path: "${swSrcPath}"`)

const swDestPath = path.join(options.dir, wbConfig.dest, wbConfig.swDest)

console.log('> Compiling progressive web app')
console.log(`> Service worker destination path: "${swDestPath}"`)
console.log(`Workbox: service worker destination path: "${swDestPath}"`)

const defaultDontCacheBustURLsMatching = /^\/_next\/static\/.*/iu

Expand Down Expand Up @@ -98,9 +101,6 @@ export function withWorkbox(
}
}

const swSrcPath = path.join(options.dir, wbConfig.swSrc)
console.log(`> Service worker source path: "${swSrcPath}"`)
console.log('> Using "WorkboxPlugin.InjectManifest"')
config.plugins.push(
new WorkboxPlugin.InjectManifest({
swSrc: swSrcPath,
Expand Down

0 comments on commit 64ab202

Please sign in to comment.