Permalink
Browse files

fix(workbox): don't use regexs

  • Loading branch information...
pi0 committed Jul 19, 2017
1 parent d80aa8a commit 19502d92e7fd8ca82f00803c3a9ef7c995696836
Showing with 2 additions and 3 deletions.
  1. +2 −3 modules/workbox/index.js
@@ -2,7 +2,6 @@ const path = require('path')
const workboxPlugin = require('workbox-webpack-plugin')
const fixUrl = url => url.replace(/\/\//g, '/').replace(':/', '://')
const wildcardRegex = url => '/' + fixUrl(url + '/.*').replace(/\//g, '\\/') + '/'
const isUrl = url => url.indexOf('http') === 0 || url.indexOf('//') === 0
module.exports = function nuxtWorkbox (options) {
@@ -39,12 +38,12 @@ module.exports = function nuxtWorkbox (options) {
// Cache other _nuxt resources runtime
// They are hashed by webpack so are safe to loaded by cacheFirst handler
{
urlPattern: wildcardRegex(publicPath),
urlPattern: fixUrl(publicPath + '/**'),
handler: 'cacheFirst'
},
// Cache routes if offline
{
urlPattern: wildcardRegex(routerBase),
urlPattern: fixUrl(routerBase + '/**'),
handler: 'networkFirst'
}
]

0 comments on commit 19502d9

Please sign in to comment.