diff --git a/src/mono/browser/runtime/loader/globals.ts b/src/mono/browser/runtime/loader/globals.ts index 925474d4758853..21293314654d34 100644 --- a/src/mono/browser/runtime/loader/globals.ts +++ b/src/mono/browser/runtime/loader/globals.ts @@ -4,6 +4,8 @@ /* eslint-disable @typescript-eslint/triple-slash-reference */ /// +import WasmEnableThreads from "consts:wasmEnableThreads"; + import { exceptions, simd, relaxedSimd } from "wasm-feature-detect"; import gitHash from "consts:gitHash"; @@ -17,8 +19,8 @@ import { mono_log_error, set_thread_prefix, setup_proxy_console } from "./loggin import { invokeLibraryInitializers } from "./libraryInitializers"; import { deep_merge_config, isDebuggingSupported } from "./config"; -// if we are the first script loaded in the web worker, we are expected to become the sidecar -if (typeof importScripts === "function" && !globalThis.onmessage) { +// if we are ST build or the first script loaded in the web worker, we are expected to become the sidecar +if (typeof importScripts === "function" && (!WasmEnableThreads || !globalThis.onmessage)) { (globalThis as any).dotnetSidecar = true; }