Skip to content


[wasm] Fix startup without emcc -g option (#89872)
Browse files Browse the repository at this point in the history
When compiling without the emcc -g switch, the "env" module becomes "a", which caused startup to break.
Co-authored-by: Pavel Savara <>
  • Loading branch information
kg committed Aug 5, 2023
1 parent 33c870e commit a820ef7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/mono/wasm/runtime/startup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,13 @@ function replace_linker_placeholders(
) {
// the output from emcc contains wrappers for these linker imports which add overhead,
// but now we have what we need to replace them with the actual functions
const env = imports.env;
// By default the imports all live inside of 'env', but emscripten minification could rename it to 'a'.
// See
const env = imports.env || imports.a;
if (!env) {
mono_log_warn("WARNING: Neither imports.env or imports.a were present when instantiating the wasm module. This likely indicates an emscripten configuration issue.");
for (const k in realFunctions) {
const v = realFunctions[k];
if (typeof (v) !== "function")
Expand Down

0 comments on commit a820ef7

Please sign in to comment.