【发布时间】:2020-07-14 21:07:07
【问题描述】:
我已经设置了 nuxt pwa 模块来使用 nuxt firebase auth 并且它工作正常,另外我添加了图标和清单以利用可下载的应用程序。问题是我一定是在工作箱上做错了,因为如果您离线,我的应用程序将无法加载。将显示默认浏览器离线消息。我的工作箱配置是
workbox: {
runtimeCaching: [{
urlPattern: 'https://twitch-toc.now.sh/.*',
handler: 'cacheFirst',
method: 'GET',
strategyOptions: {
networkTimeoutSeconds: 20,
cacheName: 'api-cache',
cacheableResponse: {
statuses: [0, 200]
}
}
}
],
importScripts: [
// ...
'/firebase-auth-sw.js'
],
// by default the workbox module will not install the service worker in dev environment to avoid conflicts with HMR
// only set this true for testing and remember to always clear your browser cache in development
// dev: process.env.NODE_ENV === 'development'
}
请让我知道我缺少什么,因为我找不到任何有关如何使其工作的文档或指南。
【问题讨论】:
-
您找到解决方法了吗?愿意分享吗?
标签: vue.js nuxt.js progressive-web-apps workbox