Don't rely on window (#4697)

This commit is contained in:
Moritz Hedtke authored and GitHub committed 2025-09-26 13:44:25 +01:00
1 parent 2e7e0696a3
commit 10912f4750
1 file changed
+5 -5
+5 -5
View File
@@ -3875,15 +3875,15 @@ impl BuildRequest {
writeln!( writeln!(
buf_writer, buf_writer,
r#" r#"
window.__wasm_split_main_initSync = initSync; globalThis.__wasm_split_main_initSync = initSync;
// Actually perform the load // Actually perform the load
__wbg_init({{module_or_path: "/{}/{wasm_path}"}}).then((wasm) => {{ __wbg_init({{module_or_path: "/{}/{wasm_path}"}}).then((wasm) => {{
// assign this module to be accessible globally // assign this module to be accessible globally
window.__dx_mainWasm = wasm; globalThis.__dx_mainWasm = wasm;
window.__dx_mainInit = __wbg_init; globalThis.__dx_mainInit = __wbg_init;
window.__dx_mainInitSync = initSync; globalThis.__dx_mainInitSync = initSync;
window.__dx___wbg_get_imports = __wbg_get_imports; globalThis.__dx___wbg_get_imports = __wbg_get_imports;
if (wasm.__wbindgen_start == undefined) {{ if (wasm.__wbindgen_start == undefined) {{
wasm.main(); wasm.main();