From b03dc14b7c99cbf0eac9470f09b50d9089ea760a Mon Sep 17 00:00:00 2001 From: pooya parsa Date: Tue, 19 Feb 2019 00:02:08 +0330 Subject: [PATCH] fix(manifest): remove publicPath field --- packages/manifest/index.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/manifest/index.js b/packages/manifest/index.js index 5821d8a6..1177b63e 100755 --- a/packages/manifest/index.js +++ b/packages/manifest/index.js @@ -14,10 +14,10 @@ module.exports = function nuxtManifest (options) { this.nuxt.hook('build:before', hook) } -function addManifest (options) { +function addManifest (_options) { const { routerBase, publicPath } = getRouteParams(this.options) - // Defaults + // Combine sources const defaults = { name: process.env.npm_package_name, short_name: process.env.npm_package_name, @@ -30,10 +30,12 @@ function addManifest (options) { theme_color: this.options.loading && this.options.loading.color, lang: 'en' } + const options = { ...defaults, ...this.options.manifest, ..._options } - // Combine sources - const manifest = Object.assign({}, defaults, this.options.manifest, options) + // Remve extra fields from manifest + const manifest = { ...options } delete manifest.src + delete manifest.publicPath // Stringify manifest & generate hash const manifestSource = JSON.stringify(manifest) @@ -59,7 +61,7 @@ function addManifest (options) { // Add manifest meta if (!find(this.options.head.link, 'rel', 'manifest')) { - const baseAttribute = { rel: 'manifest', href: joinUrl(manifest.publicPath, manifestFileName) } + const baseAttribute = { rel: 'manifest', href: joinUrl(options.publicPath, manifestFileName) } const attribute = manifest.crossorigin ? Object.assign({}, baseAttribute, { crossorigin: manifest.crossorigin }) : baseAttribute this.options.head.link.push(attribute) } else {