mirror of
https://github.com/Since-3/Kuma.git
synced 2026-10-12 19:51:17 +00:00
fix service worker
This commit is contained in:
parent
16728da422
commit
1866d70691
1 changed files with 9 additions and 6 deletions
|
|
@ -1,14 +1,17 @@
|
|||
import { spawnSync } from "node:child_process";
|
||||
import { createSerwistRoute } from "@serwist/turbopack";
|
||||
|
||||
const revision =
|
||||
spawnSync("git", ["rev-parse", "HEAD"], { encoding: "utf-8" }).stdout?.trim() ||
|
||||
crypto.randomUUID();
|
||||
|
||||
export const { dynamic, dynamicParams, revalidate, generateStaticParams, GET } = createSerwistRoute(
|
||||
{
|
||||
swSrc: "src/app/sw.ts",
|
||||
additionalPrecacheEntries: [{ url: "/manifest.json", revision }],
|
||||
// KEIN additionalPrecacheEntries für "/manifest.json": Next.js nimmt
|
||||
// Dateien aus public/ bereits automatisch mit einer eigenen Revision ins
|
||||
// Precache-Manifest auf. Ein zusätzlicher, händischer Eintrag für
|
||||
// dieselbe URL erzeugte zwei Objekte mit unterschiedlicher Revision im
|
||||
// selben Manifest - Serwist wirft dann synchron beim Erstellen von
|
||||
// `new Serwist(...)` "add-to-cache-list-conflicting-entries", was Chrome
|
||||
// als "ServiceWorker script evaluation failed" meldet (reproduziert:
|
||||
// beide Sentry-Issues #146975555 und #146993234 waren derselbe Bug).
|
||||
//
|
||||
// Default ist nur auf win32 true (siehe @serwist/turbopack), auf
|
||||
// Linux/macOS sonst esbuild-wasm - explizit erzwungen, damit das
|
||||
// Verhalten plattformunabhängig gleich ist (esbuild bleibt außerdem als
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue