diff --git a/web/src/App.tsx b/web/src/App.tsx
index 56242ce26..35fcb974f 100644
--- a/web/src/App.tsx
+++ b/web/src/App.tsx
@@ -26,11 +26,6 @@ const App = () => {
}, [systemStatus.host]);
useEffect(() => {
- const initialGoWASMExec = async () => {
- const go = new window.Go();
- const result = await WebAssembly.instantiateStreaming(fetch("/gomark.wasm"), go.importObject);
- go.run(result.instance);
- };
const initialState = async () => {
try {
await userStore.fetchCurrentUser();
@@ -39,7 +34,7 @@ const App = () => {
}
};
- Promise.all([initialGoWASMExec(), initialState()]).then(() => setLoading(false));
+ Promise.all([initialState()]).then(() => setLoading(false));
}, []);
useEffect(() => {
diff --git a/web/public/gomark.wasm b/web/src/gomark.wasm
similarity index 100%
rename from web/public/gomark.wasm
rename to web/src/gomark.wasm
diff --git a/web/src/main.tsx b/web/src/main.tsx
index 295dec551..db7ffb4c1 100644
--- a/web/src/main.tsx
+++ b/web/src/main.tsx
@@ -5,6 +5,7 @@ import { Provider } from "react-redux";
import { RouterProvider } from "react-router-dom";
import "./css/global.css";
import "./css/tailwind.css";
+import wasmUrl from "./gomark.wasm?url";
import "./helpers/polyfill";
import "./i18n";
import "./less/highlight.less";
@@ -12,13 +13,20 @@ import router from "./router";
import store from "./store";
import theme from "./theme";
-const container = document.getElementById("root");
-const root = createRoot(container as HTMLElement);
-root.render(
-
-
-
-
-
- ,
-);
+(async () => {
+ const go = new window.Go();
+ const responsePromise = fetch(wasmUrl);
+ const { instance } = await WebAssembly.instantiateStreaming(responsePromise, go.importObject);
+ go.run(instance);
+
+ const container = document.getElementById("root");
+ const root = createRoot(container as HTMLElement);
+ root.render(
+
+
+
+
+
+ ,
+ );
+})();