Skip to content

Commit efcdba4

Browse files
committed
Add __wbindgen_main to other backends
1 parent b22ce83 commit efcdba4

File tree

1 file changed

+10
-1
lines changed
  • crates/cli-support/src/js

1 file changed

+10
-1
lines changed

crates/cli-support/src/js/mod.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,9 @@ impl<'a> Context<'a> {
414414

415415
if needs_manual_start {
416416
footer.push_str("\nwasm.__wbindgen_start();\n");
417+
if self.start_found {
418+
footer.push_str("\nwasm.__wbindgen_main();\n");
419+
}
417420
}
418421
}
419422

@@ -428,6 +431,9 @@ impl<'a> Context<'a> {
428431

429432
if needs_manual_start {
430433
footer.push_str("\nwasm.__wbindgen_start();\n");
434+
if self.start_found {
435+
footer.push_str("\nwasm.__wbindgen_main();\n");
436+
}
431437
}
432438
}
433439

@@ -461,7 +467,10 @@ impl<'a> Context<'a> {
461467
}
462468

463469
if needs_manual_start {
464-
start = Some("\nwasm.__wbindgen_start();\n".to_string());
470+
let start = start.insert("\nwasm.__wbindgen_start();\n".to_string());
471+
if self.start_found {
472+
start.push_str("\nwasm.__wbindgen_main();\n");
473+
}
465474
}
466475
}
467476

0 commit comments

Comments
 (0)