diff --git a/docs/modules/workbox.md b/docs/modules/workbox.md index e05b085c..b3515de1 100644 --- a/docs/modules/workbox.md +++ b/docs/modules/workbox.md @@ -141,7 +141,7 @@ Default: `/_nuxt/(?!.*(__webpack_hmr|hot-update))` Default is auto generated based on `router.base`. -Default: `^/(?!.*(__webpack_hmr|hot-update))` +Default: `/(?!.*(__webpack_hmr|hot-update))` diff --git a/packages/workbox/lib/options.js b/packages/workbox/lib/options.js index 037a1931..66dc07a2 100644 --- a/packages/workbox/lib/options.js +++ b/packages/workbox/lib/options.js @@ -53,7 +53,7 @@ function getOptions (moduleOptions) { // Optionally cache other routes for offline if (!options.pagesURLPattern) { - options.pagesURLPattern = joinUrl(`^${options.routerBase}`, HMRRegex) + options.pagesURLPattern = joinUrl(options.routerBase, HMRRegex) } if (options.offline && !options.offlinePage) { options.runtimeCaching.push({ diff --git a/test/__snapshots__/pwa.test.js.snap b/test/__snapshots__/pwa.test.js.snap index 4a3dc831..d0710399 100644 --- a/test/__snapshots__/pwa.test.js.snap +++ b/test/__snapshots__/pwa.test.js.snap @@ -107,7 +107,7 @@ workbox.routing.registerRoute(new RegExp('https://google.com/.*'), new workbox.s workbox.routing.registerRoute(new RegExp('/_nuxt/(?!.*(__webpack_hmr|hot-update))'), new workbox.strategies.CacheFirst ({}), 'GET') // Register router handler for offlinePage -workbox.routing.registerRoute(new RegExp('^/(?!.*(__webpack_hmr|hot-update))'), ({event}) => { +workbox.routing.registerRoute(new RegExp('/(?!.*(__webpack_hmr|hot-update))'), ({event}) => { return new workbox.strategies.NetworkOnly().handle({event}) .catch(() => caches.match('/offline.html')) }) diff --git a/test/hmr.js b/test/hmr.js index 1d8e1f41..4ae62f5f 100644 --- a/test/hmr.js +++ b/test/hmr.js @@ -11,7 +11,7 @@ const regexes = { cacheFirstCDN: new RegExp(`${CSNPublicPath}/${HMRRegex}`), // Regex for networkFist - networkFirst: new RegExp(`^/${HMRRegex}`) + networkFirst: new RegExp(`/${HMRRegex}`) } const lists = {