From d71649acb4d204e29e799e132c318056d448cefc Mon Sep 17 00:00:00 2001 From: cuining Date: Wed, 21 Jul 2021 19:09:02 +0800 Subject: [PATCH 1/2] Fix "serviceWorker.js" path --- src/browser/register.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/browser/register.ts b/src/browser/register.ts index 0c3d77904..4774ad5fa 100644 --- a/src/browser/register.ts +++ b/src/browser/register.ts @@ -5,7 +5,7 @@ export async function registerServiceWorker(): Promise { const options = getOptions() logger.level = options.logLevel - const path = normalize(`${options.csStaticBase}/dist/serviceWorker.js`) + const path = normalize(`${options.csStaticBase}/out/browser/serviceWorker.js`) try { await navigator.serviceWorker.register(path, { scope: options.base + "/", From 4e489f19b5dbb8144d2f9d43d31674e45f85a520 Mon Sep 17 00:00:00 2001 From: cuining Date: Sun, 25 Jul 2021 14:49:19 +0800 Subject: [PATCH 2/2] Update register.test.ts --- test/unit/browser/register.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/unit/browser/register.test.ts b/test/unit/browser/register.test.ts index 6d1443f1e..f2302cb89 100644 --- a/test/unit/browser/register.test.ts +++ b/test/unit/browser/register.test.ts @@ -155,7 +155,7 @@ describe("register", () => { await registerServiceWorker() expect(mockFn).toBeCalled() - expect(serviceWorkerPath).toMatch(`${csStaticBasePath}/dist/serviceWorker.js`) + expect(serviceWorkerPath).toMatch(`${csStaticBasePath}/out/browser/serviceWorker.js`) expect(serviceWorkerScope).toMatch("/") }) it("should register when options.base is defined", async () => { @@ -176,7 +176,7 @@ describe("register", () => { await registerServiceWorker() expect(mockFn).toBeCalled() - expect(serviceWorkerPath).toMatch(`/dist/serviceWorker.js`) + expect(serviceWorkerPath).toMatch(`/out/browser/serviceWorker.js`) expect(serviceWorkerScope).toMatch("/") }) })