Vue.js Vue CLI 4-清单中的PWA插件预缓存无法获取index.html,并且不';不要给服务人员登记
将Vue CLI 3更新为CLI 4后,服务工作人员停止注册 环境:Vue.js Vue CLI 4-清单中的PWA插件预缓存无法获取index.html,并且不';不要给服务人员登记,vue.js,progressive-web-apps,vue-cli,workbox,Vue.js,Progressive Web Apps,Vue Cli,Workbox,将Vue CLI 3更新为CLI 4后,服务工作人员停止注册 环境: Firebase hosting, "vue": "^2.6.10", "vuex": "^3.1.1", "firebase": "^7.2.3", "vuetify": "^2.1.9", "core-js": "^3.3.6", ... "@vue/cli-plugin-pwa": "^4.0.5", 我看到失败出现在/index.html页面上生成的预缓存清单文件上: // precache-manife
Firebase hosting,
"vue": "^2.6.10",
"vuex": "^3.1.1",
"firebase": "^7.2.3",
"vuetify": "^2.1.9",
"core-js": "^3.3.6",
...
"@vue/cli-plugin-pwa": "^4.0.5",
我看到失败出现在/index.html页面上生成的预缓存清单文件上:
// precache-manifest.326028534d4ff40f4be7a15fc11e84c6.js
...
{
"revision": "7eeb3269c508ac628b85ccfaa20744ab",
"url": "/index.html"
},
...
我试图从workboxOptions中禁用“skipWaiting”,因为我使用了文档中所述的延迟加载路径,但它没有做任何事情:
pwa:{
workboxOptions: {
skipWaiting: false,
}
}
“网络”选项卡中的错误为:
如果我手动注释掉已编译的precache清单文件中的行,那么服务人员可以正常工作。我不明白。原来问题出在
firebase.json
的配置中,在托管部分,我启用了“cleanURL”:true
。删除它使服务人员再次注册
这就是它现在的样子,默认设置:
"hosting": {
"public": "dist",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
},