Skip to content

Commit

Permalink
fix(workbox): precache start_url (resolves #372)
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Oct 13, 2020
1 parent 90c4dfd commit 27e19a0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/manifest/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ module.exports = function nuxtManifest (nuxt, pwa) {
nuxt.options.manifest = {}
}
Object.assign(nuxt.options.manifest, manifest)
Object.assign(pwa.manifest, manifest)

// Register webpack plugin to emit manifest
const manifestSource = JSON.stringify(manifest, null, 2)
Expand Down
5 changes: 5 additions & 0 deletions lib/workbox/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ function getOptions (nuxt, pwa) {
})
}

// Add start_url to precaching
if (pwa.manifest && pwa.manifest.start_url) {
options.preCaching.unshift(pwa.manifest.start_url)
}

// Add offlineAssets to precaching
if (options.offlineAssets.length) {
options.preCaching.unshift(...options.offlineAssets)
Expand Down

0 comments on commit 27e19a0

Please sign in to comment.