Files
BetterSEQTA-Plus/lib/fixCrxWorkerLiveReload.ts
T
SethBurkart123 9bfd1bbf0e Improve grade analytics layout, controls, and forecast chart rendering.
Move filters into a left sidebar, tighten spacing, match homepage checkboxes, fix forecast line domain/looping, and remove the redundant page subtitle. Also fix crxjs dev service worker live reload after Vite upgrade.
2026-06-16 14:32:29 +10:00

20 lines
552 B
TypeScript

import type { Plugin } from "vite";
/**
* crxjs 2.6.x only replaces the first `__LIVE_RELOAD__` in `@crx/client-worker`,
* which crashes the service worker when the dev server reconnects.
*/
export default function fixCrxWorkerLiveReload(): Plugin {
return {
name: "fix-crx-worker-live-reload",
apply: "serve",
enforce: "post",
transform(code, id) {
if (!id.includes("@crx/client-worker") || !code.includes("__LIVE_RELOAD__")) {
return;
}
return code.replaceAll("__LIVE_RELOAD__", "true");
},
};
}