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, } });