You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I run wasm-pack build --target web --release build fails if I use an Array method like filter or map (I havn't tried other methods). The strange part is that wasm-pack build --target web --dev runs perfectly
Cargo.toml
[package]
name = "transforms-wasm"version = "0.1.0"authors = ["Nicolas Bruère <[email protected]>"]
edition = "2018"
[lib]
crate-type = ["cdylib"]
[features]
default = ["console_error_panic_hook"]
[dependencies]
wasm-bindgen = "0.2.93"js-sys = "0.3.70"# The `console_error_panic_hook` crate provides better debugging of panics by# logging them with `console.error`. This is great for development, but requires# all the `std::fmt` and `std::panicking` infrastructure, so isn't great for# code size when deploying.console_error_panic_hook = { version = "0.1.7", optional = true }
[dev-dependencies]
wasm-bindgen-test = "0.3.43"
[profile.release]
# Tell `rustc` to optimize for small code size.opt-level = "s"
lib.rs
#[wasm_bindgen]pubfnget_histogram(input:&Array,binsize:f64,min:f64,max:f64,dimension:i32) -> Array{let output = Array::new();letmut i = min;while i <= max {let arr = Array::new();
arr.push(&JsValue::from_f64(i));let count = input.filter(&mut |item, _, _| {let row = Array::from(&item);let o = row.at(dimension).as_f64().unwrap();if o >= i && o < (i + binsize){returntrue;}false}).length();
arr.push(&JsValue::from(count));
output.push(&arr);
i += binsize;}
output
}
The error output:
[INFO]: ⬇️ Installing wasm-bindgen...
error: failed to generates bindings for adapter
Caused by:
no function table found in module
Error: Running the wasm-bindgen CLI
Caused by: Running the wasm-bindgen CLI
Caused by: failed to execute `wasm-bindgen`: exited with exit status: 1
full command: "/Users/nicolas.bruere/Library/Caches/.wasm-pack/wasm-bindgen-507ae24572712ef8/wasm-bindgen" "/Users/nicolas.bruere/workspace/reco-explorer/transforms-wasm/target/wasm32-unknown-unknown/release/transforms_wasm.wasm" "--out-dir" "/Users/nicolas.bruere/workspace/reco-explorer/transforms-wasm/pkg" "--typescript" "--target" "web"
Steps to Reproduce
Run wasm-pack build --target web --release => you get an error
Run wasm-pack build --target web --dev => you get 0 error
For whatever reasons, all references to these functions are removed by some pre-processing done in wasm-bindgen, which then asks Walrus to do some cleanup in which this table is removed.
This would require some digging into to find out exactly what is being removed here and why.
Describe the Bug
When I run
wasm-pack build --target web --release
build fails if I use an Array method likefilter
ormap
(I havn't tried other methods). The strange part is thatwasm-pack build --target web --dev
runs perfectlyCargo.toml
lib.rs
The error output:
Steps to Reproduce
wasm-pack build --target web --release
=> you get an errorwasm-pack build --target web --dev
=> you get 0 errorhttps://we.tl/t-V6pMfd5I4B
Expected Behavior
I'd like to have the same behavior whether I'm building on dev or release. I'd be ok if both return an error since it might be a mistake I made ;)
Actual Behavior
The build command outputs an error on release mode and no errors on dev mode
The text was updated successfully, but these errors were encountered: