From ecaa8355f76d9bd9ea12392b557254b743548600 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Thu, 16 Nov 2017 20:09:21 +0330 Subject: [PATCH] fix(manifest): run only on build --- packages/manifest/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/manifest/index.js b/packages/manifest/index.js index 28fbf12e..f2e6283a 100755 --- a/packages/manifest/index.js +++ b/packages/manifest/index.js @@ -1,10 +1,18 @@ const hash = require('hash-sum') +const debug = require('debug')('nuxt:pwa:manifest') const fixUrl = url => url.replace(/\/\//g, '/').replace(':/', '://') const isUrl = url => url.indexOf('http') === 0 || url.indexOf('//') === 0 const find = (arr, key, val) => arr.find(obj => val ? obj[key] === val : obj[key]) module.exports = function nuxtManifest (options) { + this.nuxt.plugin('build', builder => { + debug('Adding manifest') + addManifest.call(this, options) + }) +} + +function addManifest (options) { // routerBase and publicPath const routerBase = this.options.router.base let publicPath = fixUrl(`${routerBase}/${this.options.build.publicPath}`)