From a1b0f3221d0761b319e9b3abe97cab49f396050e Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Sun, 18 Mar 2018 17:54:35 -0700 Subject: [PATCH] almost working except for a bug on add.html --- app/service-worker.js | 3 ++- package-lock.json | 2 +- package.json | 2 +- webpack/service-worker.config.js | 6 +++++- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/app/service-worker.js b/app/service-worker.js index fe9cf81e..8ba3c34a 100644 --- a/app/service-worker.js +++ b/app/service-worker.js @@ -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 diff --git a/package-lock.json b/package-lock.json index a55b9613..e3967121 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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", diff --git a/package.json b/package.json index a9c1e838..a866b346 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/webpack/service-worker.config.js b/webpack/service-worker.config.js index 2d6926b5..3149d2fb 100644 --- a/webpack/service-worker.config.js +++ b/webpack/service-worker.config.js @@ -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' }