You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// We should keep an eye out for these sorts of failures!
89
89
let script = format!(
90
90
r#"var pkgName = '{pkg_name}';
91
-
var snakePkgName = pkgName.replaceAll('-', '_');
92
-
var libName = {wasm_binary};
93
-
if (!(libName in LDSO.loadedLibsByName)) {{
94
-
// Always print to console, even if the error is suppressed.
95
-
console.error(`godot-rust could not find the Wasm module '${{libName}}', needed to load the '${{pkgName}}' crate. Please ensure a file named '${{libName}}' exists in the game's web export files. This may require updating Wasm paths in the crate's corresponding '.gdextension' file, or just renaming the Wasm file to the correct name otherwise.`);
96
-
throw new Error(`Wasm module '${{libName}}' not found. Check the console for more information.`);
91
+
var wasmBinary = {wasm_binary};
92
+
if (wasmBinary === null) {{
93
+
var snakePkgName = pkgName.replaceAll('-', '_');
94
+
var normalLibName = snakePkgName + '.wasm';
95
+
var threadedLibName = snakePkgName + '.threads.wasm';
96
+
if (normalLibName in LDSO.loadedLibsByName) {{
97
+
var libName = normalLibName;
98
+
}} else if (threadedLibName in LDSO.loadedLibsByName) {{
99
+
var libName = threadedLibName;
100
+
}} else {{
101
+
// Always print to console, even if the error is suppressed.
102
+
console.error(`godot-rust could not find the Wasm module '${{normalLibName}}' nor '${{threadedLibName}}', one of which is needed by default to load the '${{pkgName}}' crate. This indicates its '.wasm' binary file was renamed to an unexpected name.\n\nPlease ensure its Wasm binary file has one of those names in the game's web export files. This may require updating Wasm paths in the crate's corresponding '.gdextension' file, or just renaming the Wasm file to one of the expected names otherwise.\n\nIf that GDExtension uses a different Wasm filename, please ensure it informs this new name to godot-rust with the following option: '#[gdextension(wasm_binary = "newname.wasm")]'`);
103
+
throw new Error(`Wasm module '${{normalLibName}}' not found. Check the console for more information.`);
104
+
}}
105
+
}} else if (wasmBinary in LDSO.loadedLibsByName) {{
106
+
var libName = wasmBinary;
107
+
}} else {{
108
+
console.error(`godot-rust could not find the Wasm module '${{wasmBinary}}', needed to load the '${{pkgName}}' crate. This indicates its '.wasm' binary file was renamed to an unexpected name.\n\nPlease ensure its Wasm binary file is named '${{wasmBinary}}' in the game's web export files. This may require updating Wasm paths in the crate's corresponding '.gdextension' file, or just renaming the Wasm file to the expected name otherwise.`);
109
+
throw new Error(`Wasm module '${{wasmBinary}}' not found. Check the console for more information.`);
97
110
}}
98
111
var dso = LDSO.loadedLibsByName[libName];
99
112
// This property was renamed as of emscripten 3.1.34
0 commit comments