Skip to content

Commit c62f652

Browse files
authored
Merge pull request #1304 from alexcrichton/fix-init
Fix a `__wbindgen_placeholder__` module leaking through
2 parents da168dc + c4c0fea commit c62f652

File tree

1 file changed

+9
-8
lines changed
  • crates/cli-support/src/js

1 file changed

+9
-8
lines changed

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

+9-8
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,15 @@ impl<'a> Context<'a> {
616616
if self.config.emit_start {
617617
self.add_start_function()?;
618618
has_start_function = self.unstart_start_function();
619+
620+
// In the "we're pretending to be an ES module use case if we've got
621+
// a start function then we use an injected shim to actually execute
622+
// the real start function on the next tick of the microtask queue
623+
// (explained above)
624+
if !self.config.no_modules && has_start_function {
625+
self.inject_start_shim();
626+
}
627+
619628
}
620629

621630
self.export_table()?;
@@ -787,14 +796,6 @@ impl<'a> Context<'a> {
787796
},
788797
)
789798
} else {
790-
// In the "we're pretending to be an ES module use case if we've got
791-
// a start function then we use an injected shim to actually execute
792-
// the real start function on the next tick of the microtask queue
793-
// (explained above)
794-
if has_start_function {
795-
self.inject_start_shim();
796-
}
797-
798799
let import_wasm = if self.globals.len() == 0 {
799800
String::new()
800801
} else if self.use_node_require() {

0 commit comments

Comments
 (0)