From 2dc70b6a59e912d8bd362c7f42f038b1b04048e2 Mon Sep 17 00:00:00 2001 From: Guyutongxue Date: Sat, 18 May 2024 00:39:22 +0800 Subject: [PATCH] update --- public/sw.js | 2 +- src/main.worker.ts | 2 +- vite.config.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/public/sw.js b/public/sw.js index 4053adc..8a7e201 100644 --- a/public/sw.js +++ b/public/sw.js @@ -6,7 +6,7 @@ var self_ = /** @type {ServiceWorkerGlobalScope & typeof globalThis} */ (self); -const CACHE_KEY = "v2"; +const CACHE_KEY = "v3"; /** * diff --git a/src/main.worker.ts b/src/main.worker.ts index 4b9448c..b468c9d 100644 --- a/src/main.worker.ts +++ b/src/main.worker.ts @@ -12,7 +12,7 @@ const jsModule = import( /* @vite-ignore */ `${wasmBase}clangd.js`); // Pre-fetch wasm, and report progress to main const wasmResponse = await fetch(wasmUrl); -const wasmSize = wasmResponse.headers.get("Content-Length") ?? __WASM_SIZE__; +const wasmSize = __WASM_SIZE__; const wasmReader = wasmResponse.body!.getReader(); let receivedLength = 0; let chunks: Uint8Array[] = []; diff --git a/vite.config.ts b/vite.config.ts index 287c012..f342157 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -30,7 +30,7 @@ export default defineConfig({ dedupe: ['monaco-editor', 'vscode'] }, define: { - // Server may not provide Content-Length header, get it in build time + // Server-provided Content-Length header may be gzipped, get the real size in build time __WASM_SIZE__: fs.statSync("public/wasm/clangd.wasm").size, } });