Skip to content
Permalink
Browse files
feat: options.dev
  • Loading branch information
pooya parsa committed Feb 7, 2019
1 parent 58c972f commit fb0d38cdaec4821f479222b038d88a1a56d06e19
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 7 deletions.
@@ -28,6 +28,10 @@ workbox: {

(Object) Options to be passed to workbox before using it's modules. By default `debug` field will be set to `false` for production builds.

### `dev`

(Boolean) Enable workbox in dev mode of nuxt. (Disabled by default)

### `importScripts`

(Array) Additional scripts to be imported in service worker script. (Relative to `/`. Can be placed in `assets/` directory)
@@ -4,6 +4,8 @@ module.exports = {

config: {},

dev: false,

importScripts: [],

offline: true,
@@ -21,7 +21,8 @@ function getOptions (moduleOptions) {

// swTemplate
if (!options.swTemplate) {
options.swTemplate = path.resolve(__dirname, `../templates/sw${this.options.dev ? '.dev' : ''}.js`)
const disabled = this.options.dev && !options.dev
options.swTemplate = path.resolve(__dirname, `../templates/sw${disabled ? '.disable' : ''}.js`)
}

// swDest
@@ -70,7 +71,7 @@ function getOptions (moduleOptions) {
// Workbox Config
if (!options.config.debug) {
// Debug field is by default set to true for localhost domain which is not always ideal
options.config.debug = this.options.dev
options.config.debug = options.dev || this.options.dev
}

return options

This file was deleted.

@@ -0,0 +1 @@
// THIS FILE SHOULD NOT BE VERSION CONTROLLED
@@ -22,6 +22,7 @@ module.exports = {

workbox: {
offlineAnalytics: true,
dev: true,
config: {
debug: true
},

0 comments on commit fb0d38c

Please sign in to comment.