我正在使用我的vuejs应用程序中的workbox-window(CDN)和workbox- v3 -plugin从v4迁移到vuejs。
它在本地与http-server一起工作得很好,但是在部署之后,我得到了这个错误,并且它无法安装service worker。
print @ logger.mjs:44
(anonymous) @ logger.mjs:57
(anonymous) @ precache.mjs:23
Promise.catch (async)
installListener @ precache.mjs:20
PrecacheController.mjs:194 Uncaught (in promise) bad-precaching-response: The precaching request for 'https://dummyapp.com/_redirects?__WB_REVISION__=6a02faf7ea2a9584134ffe15779a0e44' failed with an HTTP status of 404.
at PrecacheController._addURLToCache (https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-precaching.dev.js:445:15)
at async Promise.all (index 0)
at async PrecacheController.install (https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-precaching.dev.js:352:7)我该如何解决这个问题?
发布于 2019-09-05 20:45:47
这是因为当请求预缓存资产失败并返回404时。在这种情况下,service worker安装也会失败。检查DevTools (ctrl+shift+i)中的网络选项卡,查找返回404的文件,不要预先缓存该文件。这应该可以解决这个问题。
https://stackoverflow.com/questions/57284652
复制相似问题