我正在使用 Gridsome 创建一个网站,并且我正在使用该gridsome-plugin-pwa
插件。在设置 service-worker 时,它返回一个 bad-precaching-response 错误。
这是我第一次实现这个插件,我试图重建项目,但我仍然收到错误。
下面是我导入插件的部分 gridsome.confid.js 文件。
{
use: 'gridsome-plugin-pwa',
options: {
title: 'Hummingbird Airsoft',
startUrl: '/',
display: 'standalone',
statusBarStyle: 'default',
manifestPath: 'manifest.json',
serviceWorkerPath: 'service-worker.js',
shortName: 'Gridsome',
themeColor: '#666600',
backgroundColor: '#ffffff',
icon: 'public/favicon.ico' // must be supplied!
}
}
这是自动生成的 service-worker:
/**
* Welcome to your Workbox-powered service worker!
*
* You'll need to register this file in your web app and you should
* disable HTTP caching for this file too.
*
*
* The rest of the code is auto-generated. Please don't update this file
* directly; instead, make changes to your Workbox build configuration
* and re-run your build process.
*
*/
importScripts("https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js");
self.addEventListener('message', (event) => {
if (event.data && event.data.type === 'SKIP_WAITING') {
self.skipWaiting();
}
});
/**
* The workboxSW.precacheAndRoute() method efficiently caches and responds to
* requests for URLs in the manifest.
*
*/
self.__precacheManifest = [
{
"url": "404.html",
"revision": "2c7e691bc04a90df86f4a58608f53ea2"
},
{
"url": "404/index.html",
"revision": "2c7e691bc04a90df86f4a58608f53ea2"
},
{
"url": "assets/css/0.styles.d37d9967.css",
"revision": "a7de958c90cc8fd35a3cf8912c8142a1"
},
{
"url": "assets/js/app.bb710543.js",
"revision": "eabf9e833702a689da719b2c3218f33a"
},
{
"url": "assets/js/page--node-modules--gridsome--app--pages--404-vue.3982a992.js",
"revision": "ee3d3bbe881d3231cbd8fa4d7120abde"
},
{
"url": "assets/js/page--src--pages--book-appt-vue.88aca79c.js",
"revision": "49d5980de1c51c5f58fc91324b0b66d6"
},
{
"url": "assets/js/page--src--pages--contact-vue.1afb72cc.js",
"revision": "3b58957be95492c0696946e3f2c6e76a"
},
{
"url": "assets/js/page--src--pages--index-vue.90e89481.js",
"revision": "ac1d7c17e9b1b1b2838d51ae13704e5a"
},
{
"url": "assets/js/page--src--pages--qand-a-vue.c9fac808.js",
"revision": "56bfb2d34347474e693a348161c49698"
},
{
"url": "assets/js/page--src--pages--services-vue.4d5e2b0c.js",
"revision": "bcba180b4c0d5b0cdbc36ddd1cf4804b"
},
{
"url": "assets/js/page--src--pages--thankyou-vue.bdf47035.js",
"revision": "b5898beff47aa8d4002b4f0de5a33835"
},
{
"url": "assets/manifest/client.json",
"revision": "9249c832e9ad2c821722a5b0d6941b0f"
},
{
"url": "assets/static/favicon.1539b60.9bb7ffa.png",
"revision": "7e3c420ed3359221ac22eedbc5cc1630"
},
{
"url": "assets/static/favicon.62d22cb.9bb7ffa.png",
"revision": "2f85c47cd65b86c6507ff18b2b8d5e98"
},
{
"url": "assets/static/favicon.7b22250.9bb7ffa.png",
"revision": "fa38503a9bbe98901bd244b830e4d6c5"
},
{
"url": "assets/static/favicon.ac8d93a.9bb7ffa.png",
"revision": "6b22178d5429b8ac29e5ced482659f49"
},
{
"url": "assets/static/favicon.b9532cc.9bb7ffa.png",
"revision": "540320e5aa9702b00a08f9e00d7a921e"
},
{
"url": "assets/static/favicon.ce0531f.9bb7ffa.png",
"revision": "a8710ab24cde9ded477cd08f602f7349"
},
{
"url": "assets/static/favicon.dc0cdc5.9bb7ffa.png",
"revision": "7e2074d4885eacfb8d44276b74beac92"
},
{
"url": "assets/static/favicon.f22e9f3.9bb7ffa.png",
"revision": "94b22eed0bfc12ff09d62a86659c4fab"
},
{
"url": "assets/static/favicon.png",
"revision": "fe4792d482196a50cf9ae0d9d90b6493"
},
{
"url": "book-appt/index.html",
"revision": "3885365abaf6fa6d7bac932f43d20961"
},
{
"url": "contact/index.html",
"revision": "3f50662fcff61b769258430d65c379da"
},
{
"url": "index.html",
"revision": "84136ea9caa06e7fdefaf4e46997cd2b"
},
{
"url": "manifest.json",
"revision": "1b75e86ac2961a0c14471c6e4b94877c"
},
{
"url": "qand-a/index.html",
"revision": "6739f677efce655e02fa27825bae0e6a"
},
{
"url": "services/index.html",
"revision": "6078cb952e7971fb20c0b2788c4b18ec"
},
{
"url": "thankyou/index.html",
"revision": "573c6324ce4244c4b7033989ca633bdd"
},
{
"url": "404",
"revision": "28f25f53f5ce5d7c39f9df9ad1964986"
},
{
"url": "contact",
"revision": "8048a6aaa865ac645f16b02a79e059dc"
},
{
"url": "book-appt",
"revision": "7351a6efc09ac13b2b9a9d2caeb9bef1"
},
{
"url": "qand-a",
"revision": "c65c64335e21698ab0484d445aa0d846"
},
{
"url": "services",
"revision": "85ee4822001923af7cef3ffbb73a4100"
},
{
"url": "thankyou",
"revision": "45a27ee43cbb940fb3e042ea3113f811"
}
].concat(self.__precacheManifest || []);
workbox.precaching.precacheAndRoute(self.__precacheManifest, {});
这是控制台错误:
PrecacheController.mjs:194 Uncaught (in promise) bad-precaching-response: bad-precaching-response :: [{"url":"https://www.hummingbirdairsoft.com/assets/manifest/client.json?__WB_REVISION__=9249c832e9ad2c821722a5b0d6941b0f","status":403}]
at l.o (https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-precaching.prod.js:1:1749)
at async Promise.all (index 0)
at async l.install (https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-precaching.prod.js:1:1221)
回购链接:https ://github.com/Matthew-Kanderka/hummingbird-Airsoft-Web/tree/develop