A better solution might be to use https://github.com/evanw/polywasm to run the original wasm in place.

I tried doing that at first. I kept running into edge cases that made the whole thing fall to ribbons. I gave up and am just falling back to what I know works: compiling the WASM to JS.