Skip to content

Commit 791e5c2

Browse files
committed
Change config option "disable" to "enable"
1 parent 64ab202 commit 791e5c2

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

.changeset/poor-fishes-swim.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"nextjs-workbox-config": major
3+
---
4+
5+
Change config option "disable" to "enable". It just makes more logic to me.

src/index.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export function withWorkbox(
1818
dest?: string
1919
dontCacheBustURLsMatching?: false
2020
exclude?: string[]
21-
disable?: boolean
21+
enable?: boolean
2222
modifyURLPrefix?: Record<string, string>
2323
swDest?: string
2424
swSrc?: string
@@ -35,12 +35,10 @@ export function withWorkbox(
3535
const wbConfig = {
3636
additionalManifestEntries: [],
3737
dest: 'public',
38-
dontCacheBustURLsMatching: false,
3938
exclude: [],
40-
disable: false,
39+
enable: true,
4140
modifyURLPrefix: {},
4241
swDest: 'sw.js',
43-
swSrc: false,
4442
...(options.config.workbox || {})
4543
}
4644

@@ -51,7 +49,7 @@ export function withWorkbox(
5149
throw new Error('Workbox: service worker "path" is missing')
5250
}
5351

54-
if (wbConfig.disable) {
52+
if (!wbConfig.enable) {
5553
console.log('Workbox: service worker is disabled')
5654

5755
return config

0 commit comments

Comments
 (0)