diff --git a/page/public/emulator-worker.js b/page/public/emulator-worker.js index 6144f61f..dc03040b 100644 --- a/page/public/emulator-worker.js +++ b/page/public/emulator-worker.js @@ -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); } } diff --git a/page/src/App.tsx b/page/src/App.tsx index d9a4510a..2a12e2fd 100644 --- a/page/src/App.tsx +++ b/page/src/App.tsx @@ -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"; diff --git a/page/src/emulator.ts b/page/src/emulator.ts index 22232c15..8619f9af 100644 --- a/page/src/emulator.ts +++ b/page/src/emulator.ts @@ -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, }, }); } diff --git a/page/vite.config.ts b/page/vite.config.ts index 99a4d690..67b4817c 100644 --- a/page/vite.config.ts +++ b/page/vite.config.ts @@ -40,6 +40,7 @@ export default defineConfig({ }, workbox: { maximumFileSizeToCacheInBytes: 100 * mb, + cleanupOutdatedCaches: true, globPatterns: ["**/*.{js,css,html,woff,woff2,wasm}"], runtimeCaching: [ generateExternalCache(