我们正在使用“下一个离线”创建pwa。生成的service-worker预缓存请求大约有60个文件,并且在加载第一页并开始安装service-worker之后,所有预缓存请求都将并行下载,并且此行为使其他用户交互不再可能,因为其他重要的资源请求被挂起了。服务工作者预缓存请求。
下一个离线版本:4.0.6
const nextConfig = {
generateInDevMode: true,workboxOpts: {
maximumFileSizeToCacheInBytes: 5 * 1024 * 1024,runtimeCaching: [
{
urlPattern: /(http[s]?:\/\/)?(api\.torob\.com\/).*/,handler: 'NetworkFirst',options: {
cacheableResponse: {
statuses: [200]
}
}
},{
urlPattern: /(http[s]?:\/\/)?(torob\.com|pwa\.torob\.com|localhost:3002)(\/search|\/special-offers|\/price-list|\/shop-list|\/shop|\/\?utm_source=homescreen|$)+.*/,options: {
cacheableResponse: {
statuses: [200]
}
}
}
]
}
}
如何将下一个离线预缓存请求配置为具有比其他主要用户请求(例如product.js)更低的优先级?