Permalink
Browse files

fix(workbox): infer default value of globDirectory from webpack config.

fixes #83.
  • Loading branch information...
pi0 committed Aug 25, 2018
1 parent 3c99328 commit c7102fdede1f790044cdd7e88212997b4693d963
Showing with 11 additions and 2 deletions.
  1. +11 −2 packages/workbox/index.js
@@ -17,15 +17,24 @@ module.exports = function nuxtWorkbox (moduleOptions) {
return
}
let options
const hook = builder => {
debug('Adding workbox')
const options = getOptions.call(this, moduleOptions)
options = getOptions.call(this, moduleOptions)
workboxInject.call(this, options)
setHeaders.call(this, options)
emitAssets.call(this, options)
addTemplates.call(this, options)
}
// Get client output path (#83)
this.extendBuild((config, { isClient }) => {
if (isClient && !options.globDirectory) {
options.globDirectory = config.output.path
}
})
this.nuxt.hook ? this.nuxt.hook('build:before', hook) : this.nuxt.plugin('build', hook)
}
@@ -67,7 +76,7 @@ function getOptions (moduleOptions) {
clientsClaim: true,
skipWaiting: true,
globPatterns: ['**/*.{js,css}'],
globDirectory: path.resolve(this.options.buildDir, 'dist'),
globDirectory: undefined,
modifyUrlPrefix: {
'': fixUrl(publicPath)
},

0 comments on commit c7102fd

Please sign in to comment.