almost working except for a bug on add.html

This commit is contained in:
Nolan Lawson 2018-03-18 17:54:35 -07:00
parent 3d6124fcc9
commit a1b0f3221d
4 changed files with 9 additions and 4 deletions

View File

@ -5,6 +5,7 @@ const ASSETS = `cache${timestamp}`
// `shell` is an array of all the files generated by webpack,
// `assets` is an array of everything in the `assets` directory
const toCache = shell.concat(assets)
.concat(['/'])
.filter(filename => !filename.endsWith('.map'))
.filter(filename => !filename.startsWith('apple-icon'))
const cached = new Set(toCache)
@ -58,7 +59,7 @@ self.addEventListener('fetch', event => {
if (url.origin === self.origin &&
routes.find(route => route.pattern.test(url.pathname))) {
return caches.match('/index.html')
return caches.match('/')
}
// For these GET requests, go cache-first

2
package-lock.json generated
View File

@ -7960,7 +7960,7 @@
}
},
"sapper": {
"version": "github:nolanlawson/sapper#f8410836609759a6435db16512b1f9ecf7b091b2",
"version": "github:nolanlawson/sapper#2f8b7b646ace50fbb2f18b7b989f66d08b6c690a",
"requires": {
"cheerio": "1.0.0-rc.2",
"chokidar": "2.0.2",

View File

@ -53,7 +53,7 @@
"pify": "^3.0.0",
"quick-lru": "^1.1.0",
"requestidlecallback": "^0.3.0",
"sapper": "nolanlawson/sapper#ignore-source-maps-built",
"sapper": "github:nolanlawson/sapper#ignore-source-maps-built",
"serve-static": "^1.13.1",
"standard": "^10.0.3",
"stringz": "^0.4.0",

View File

@ -1,7 +1,11 @@
const config = require('sapper/webpack/config.js')
const mode = process.env.NODE_ENV
const isDev = mode === 'development'
module.exports = {
entry: config.serviceworker.entry(),
output: config.serviceworker.output(),
mode: process.env.NODE_ENV
mode: process.env.NODE_ENV,
devtool: isDev ? 'inline-source-map' : 'source-map'
}