Merge pull request #1063 from alexcrichton/wasm2es6js-start

wasm2es6js: Fix handling of start function
This commit is contained in:
Alex Crichton
2018-11-29 17:30:24 -06:00
committed by GitHub
3 changed files with 85 additions and 20 deletions

View File

@ -68,8 +68,10 @@ pub fn spawn(
let output = Config::new()
.fetch(Some(format!("/{}", wasm_name)))
.generate(&wasm)?;
let js = output.js()?;
let (js, wasm) = output.js_and_wasm()?;
let wasm = wasm.unwrap();
fs::write(tmpdir.join(format!("{}_bg.js", module)), js).context("failed to write JS file")?;
fs::write(tmpdir.join(format!("{}_bg.wasm", module)), wasm).context("failed to write wasm file")?;
// For now, always run forever on this port. We may update this later!
let tmpdir = tmpdir.to_path_buf();