Skip to content

Commit 27e19a0

Browse files
committed
fix(workbox): precache start_url (resolves #372)
1 parent 90c4dfd commit 27e19a0

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

lib/manifest/module.js

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ module.exports = function nuxtManifest (nuxt, pwa) {
4040
nuxt.options.manifest = {}
4141
}
4242
Object.assign(nuxt.options.manifest, manifest)
43+
Object.assign(pwa.manifest, manifest)
4344

4445
// Register webpack plugin to emit manifest
4546
const manifestSource = JSON.stringify(manifest, null, 2)

lib/workbox/options.js

+5
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ function getOptions (nuxt, pwa) {
6161
})
6262
}
6363

64+
// Add start_url to precaching
65+
if (pwa.manifest && pwa.manifest.start_url) {
66+
options.preCaching.unshift(pwa.manifest.start_url)
67+
}
68+
6469
// Add offlineAssets to precaching
6570
if (options.offlineAssets.length) {
6671
options.preCaching.unshift(...options.offlineAssets)

0 commit comments

Comments
 (0)