工作箱窗口无法安装服务工作者



我在我的vuejs app中使用Workbox-Window(CDN(和Workbox-webpack-plugin迁移V3表格为V4。

它可以与HTTP-Server在本地正常工作,但是部署后,我会得到此错误,并且无法安装服务工作者。

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)

我该如何修复?

发生这种情况,因为当对404的请求失败时。在这种情况下,服务工作者的安装也将失败。查看DevTools(Ctrl Shift I(中的"网络"选项卡,以获取返回404的文件,请勿凝视该文件。这应该解决问题。

最新更新