rust-native-wasm-loader
rust-native-wasm-loader copied to clipboard
wasm-bindgen not found during webpack chaining
Hi I'm getting error (looks like it can't find wasm-bindgen):

I have wasm-bindgen installed on my system (can compile .rs into .wasm with [wasm-pack build]).
I use Vue cli, not sure if that matters (it's just a wrapper for webpack). Would you have any ideas to solve this? I can use .wasm files built with wasm-pack, but can't .rs from webpack loader chaining.
Vue Webpack chain config:
config.module
.rule("Rust")
.test(/\.rs$/)
.use("wasm-loader")
.loader("rust-native-wasm-loader")
.options({
release: true
});
.rs import:
import loadAdd from "@/js/wasm/hello_world/hello_world.rs";
loadAdd().then(result => {
const add = result.instance.exports["add"];
console.log("return value was", add(2, 3));
});
I tried using the [wasm-bindgen experimental support] webpack config provided on your page a well, but getting same error.
I got the same problem, wasm-bindgen not found. even remove wasm2es6js option.

If I build it by wasm-pack, everything is good.
Solved after install wasm-bindgen-cli by cargo.
It's because I'm new on Rust.