我正在尝试预缓存路由。我已成功使用预缓存主页
workbox.precaching.precacheAndRoute(['/']);
这与主页的路线相匹配
workbox.routing.registerRoute(
/^\/$/,
new workbox.strategies.NetworkFirst({
cacheName: 'static-resources',
})
);
我还有其他顶级路线我想匹配但不知道如何匹配。
localhost/subcategory //subcategory and slug attached to it
localhost/product //product and slug attached to it
localhost/product-single // and slug attached to it
我如何为上述编写正则表达式