From 178790d816f2e71411cf107bd4ce790cef5fbed9 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Tue, 23 Mar 2021 15:20:33 +0100 Subject: [PATCH] symlink service worker for local dev, so its scope captures whole app also rename service worker (as it is not a template anymore) --- scripts/build.mjs | 2 +- .../web/{service-worker.template.js => service-worker.js} | 0 sw.js | 1 + 3 files changed, 2 insertions(+), 1 deletion(-) rename src/platform/web/{service-worker.template.js => service-worker.js} (100%) create mode 120000 sw.js diff --git a/scripts/build.mjs b/scripts/build.mjs index 29a4bb54..ef043135 100644 --- a/scripts/build.mjs +++ b/scripts/build.mjs @@ -90,7 +90,7 @@ async function build({modernOnly}) { await buildManifest(assets); // all assets have been added, create a hash from all assets name to cache unhashed files like index.html assets.addToHashForAll("index.html", devHtml); - let swSource = await fs.readFile(path.join(projectDir, "src/platform/web/service-worker.template.js"), "utf8"); + let swSource = await fs.readFile(path.join(projectDir, "src/platform/web/service-worker.js"), "utf8"); assets.addToHashForAll("sw.js", swSource); const globalHash = assets.hashForAll(); diff --git a/src/platform/web/service-worker.template.js b/src/platform/web/service-worker.js similarity index 100% rename from src/platform/web/service-worker.template.js rename to src/platform/web/service-worker.js diff --git a/sw.js b/sw.js new file mode 120000 index 00000000..edcb3642 --- /dev/null +++ b/sw.js @@ -0,0 +1 @@ +src/platform/web/service-worker.js \ No newline at end of file