Don't use cache buster

This commit is contained in:
momo5502
2025-09-06 21:17:38 +02:00
parent 330ce10b4d
commit 253890dd0f
4 changed files with 14 additions and 20 deletions

View File

@@ -87,7 +87,8 @@ function runEmulation(
noInitialRun: true,
locateFile: (path, scriptDirectory) => {
const bitness = wasm64 ? "64" : "32";
return `${scriptDirectory}${bitness}/${path}?${cacheBuster}`;
const busterParams = cacheBuster ? `?${cacheBuster}` : "";
return `${scriptDirectory}${bitness}/${path}${busterParams}`;
},
onRuntimeInitialized: function () {
FS.mkdir("/root");
@@ -105,9 +106,11 @@ function runEmulation(
postRun: flushLines,
};
const busterParams = cacheBuster ? `?${cacheBuster}` : "";
if (wasm64) {
importScripts("./64/analyzer.js?" + cacheBuster);
importScripts("./64/analyzer.js" + busterParams);
} else {
importScripts("./32/analyzer.js?" + cacheBuster);
importScripts("./32/analyzer.js" + busterParams);
}
}

View File

@@ -1,20 +1,12 @@
import { ThemeProvider } from "@/components/theme-provider";
import { TooltipProvider } from "@/components/ui/tooltip";
import { HashRouter, Route, Routes, Navigate } from "react-router-dom";
import { Playground, PlaygroundFile, storeEmulateData } from "./playground";
import { Playground, storeEmulateData } from "./playground";
import { LandingPage } from "./landing-page";
import { useParams } from "react-router-dom";
import "@fontsource/inter/100.css";
import "@fontsource/inter/200.css";
import "@fontsource/inter/300.css";
import "@fontsource/inter/400.css";
import "@fontsource/inter/500.css";
import "@fontsource/inter/600.css";
import "@fontsource/inter/700.css";
import "@fontsource/inter/800.css";
import "@fontsource/inter/900.css";
import "@fontsource/inter/latin.css";
import "./App.css";

View File

@@ -73,6 +73,8 @@ function decodeEvent(data: string) {
type StateChangeHandler = (state: EmulationState) => void;
type StatusUpdateHandler = (status: EmulationStatus) => void;
const cacheBuster = undefined; //import.meta.env.VITE_BUILD_TIME || Date.now();
export class Emulator {
logHandler: LogHandler;
stateChangeHandler: StateChangeHandler;
@@ -99,13 +101,9 @@ export class Emulator {
this.terminateReject = reject;
});
const cacheBuster = import.meta.env.VITE_BUILD_TIME || Date.now();
this.worker = new Worker(
/*new URL('./emulator-worker.js', import.meta.url)*/ "./emulator-worker.js?" +
cacheBuster,
);
const busterParams = cacheBuster ? `?${cacheBuster}` : "";
this.worker = new Worker("./emulator-worker.js" + busterParams);
this.worker.onerror = this._onError.bind(this);
this.worker.onmessage = (e) => queueMicrotask(() => this._onMessage(e));
}
@@ -124,7 +122,7 @@ export class Emulator {
arguments: options.applicationOptions,
persist: settings.persist,
wasm64: settings.wasm64,
cacheBuster: import.meta.env.VITE_BUILD_TIME || Date.now(),
cacheBuster,
},
});
}

View File

@@ -40,6 +40,7 @@ export default defineConfig({
},
workbox: {
maximumFileSizeToCacheInBytes: 100 * mb,
cleanupOutdatedCaches: true,
globPatterns: ["**/*.{js,css,html,woff,woff2,wasm}"],
runtimeCaching: [
generateExternalCache(