aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Stendahl <jakobste@uio.no>2020-10-14 13:19:00 +0200
committerJakob Stendahl <jakobste@uio.no>2020-10-14 13:19:00 +0200
commit606c645dd9a883c4e3c0a64cb92d56a1445d8341 (patch)
tree049c2df23155539aa5c5428bbb85539d239e44f6
parent24757056f13ea75f957850b2669bfd8e81ea0f54 (diff)
downloadAurora-data-606c645dd9a883c4e3c0a64cb92d56a1445d8341.tar.gz
Aurora-data-606c645dd9a883c4e3c0a64cb92d56a1445d8341.zip
Fix gh-pages path problem with service-worker
-rw-r--r--package.json2
-rw-r--r--src/service-worker.ts6
2 files changed, 6 insertions, 2 deletions
diff --git a/package.json b/package.json
index f56e50a..b1f5e1c 100644
--- a/package.json
+++ b/package.json
@@ -7,7 +7,7 @@
"build": "npm run build:css && sapper build --legacy",
"watch:css": "postcss static/global.css -o static/index.css -w",
"build:css": "NODE_ENV=production postcss static/global.css -o static/index.css",
- "export": "sapper export --basepath Aurora-data --legacy",
+ "export": "sapper export --basepath 'Aurora-data' --legacy",
"start": "node __sapper__/build",
"start:dev": "sapper dev",
"cy:run": "cypress run",
diff --git a/src/service-worker.ts b/src/service-worker.ts
index 1441676..b721b18 100644
--- a/src/service-worker.ts
+++ b/src/service-worker.ts
@@ -2,9 +2,13 @@ import { timestamp, files, shell, routes } from '@sapper/service-worker';
const ASSETS = `cache${timestamp}`;
+
+const nonRootFiles = files.map(f => "/Aurora-data" + f);
+const nonRootShell = shell.map(f => "/Aurora-data" + f);
+
// `shell` is an array of all the files generated by the bundler,
// `files` is an array of everything in the `static` directory
-const to_cache = (shell as string[]).concat(files as string[]);
+const to_cache = nonRootShell.concat(nonRootFiles);
const cached = new Set(to_cache);
self.addEventListener('install', <EventType extends ExtendableEvent>(event: EventType) => {