File tree Expand file tree Collapse file tree 6 files changed +11
-7
lines changed Expand file tree Collapse file tree 6 files changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,10 @@ workbox: {
28
28
29
29
(Object) Options to be passed to workbox before using it's modules. By default ` debug ` field will be set to ` false ` for production builds.
30
30
31
+ ### ` dev `
32
+
33
+ (Boolean) Enable workbox in dev mode of nuxt. (Disabled by default)
34
+
31
35
### ` importScripts `
32
36
33
37
(Array) Additional scripts to be imported in service worker script. (Relative to ` / ` . Can be placed in ` assets/ ` directory)
Original file line number Diff line number Diff line change @@ -4,6 +4,8 @@ module.exports = {
4
4
5
5
config : { } ,
6
6
7
+ dev : false ,
8
+
7
9
importScripts : [ ] ,
8
10
9
11
offline : true ,
Original file line number Diff line number Diff line change @@ -21,7 +21,8 @@ function getOptions (moduleOptions) {
21
21
22
22
// swTemplate
23
23
if ( ! options . swTemplate ) {
24
- options . swTemplate = path . resolve ( __dirname , `../templates/sw${ this . options . dev ? '.dev' : '' } .js` )
24
+ const disabled = this . options . dev && ! options . dev
25
+ options . swTemplate = path . resolve ( __dirname , `../templates/sw${ disabled ? '.disable' : '' } .js` )
25
26
}
26
27
27
28
// swDest
@@ -70,7 +71,7 @@ function getOptions (moduleOptions) {
70
71
// Workbox Config
71
72
if ( ! options . config . debug ) {
72
73
// Debug field is by default set to true for localhost domain which is not always ideal
73
- options . config . debug = this . options . dev
74
+ options . config . debug = options . dev || this . options . dev
74
75
}
75
76
76
77
return options
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ // THIS FILE SHOULD NOT BE VERSION CONTROLLED
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ module.exports = {
22
22
23
23
workbox : {
24
24
offlineAnalytics : true ,
25
+ dev : true ,
25
26
config : {
26
27
debug : true
27
28
} ,
You can’t perform that action at this time.
0 commit comments