I just stumbled upon the issue that the wasm-bindgen does not seem to be working with the latest nightly release if you pass rustc compiler flags for threading, e.g. rustflags=["-C", "target-feature=+atomics,+bulk-memory"].
This results in an obscure error that says
wasm-bindgen is currently incompatible with modules that already have a start function
I have found out that using an older nightly version fixes the issue. In my case I had to use nightly-2020-05-15 as new versions always told me that rustfmt for target 'x86_64-apple-darwin' is unavailable.
wasm-pack new testwasm-pack build with RUSTFLAGS='-C target-feature=+atomics,+bulk-memory'I am not sure if this is a bug with the rust compiler itself or if it's an issue with wasm-bindgen, but I'd say that this should work very similar to older nightly versions such as nightly-2020-05-15.
I think this was fixed very recently in https://github.com/rustwasm/wasm-bindgen/pull/2183, can y'all try that and see if it fixes things?
Heya, I've tried it out and it works (I also ran into the same problem).
Steps to use repository version
Install wasm-bindgen-cli from repository
git clone [email protected]:rustwasm/wasm-bindgen.git
cd wasm-bindgen
cargo install --path crates/cli -Z unstable-options --profile release --force
Patch your project to use the local repository copy:
# Cargo.toml
[patch.crates-io]
wasm-bindgen = { path = "/path/to/rustwasm/wasm-bindgen" }
Build as normal.
I'm going to close this since I believe it's fixed, but if it's still an issue let me know!