We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi,
I've been trying to get the example to work, but I'm receiving an error that I haven't been able to solve. I must have overlooked something.
Taking the example from the documentation:
index.js
import("./pkg").then((module) => { module.greet("42"); });
lib.rs
use wasm_bindgen::prelude::*; #[wasm_bindgen] extern "C" { fn alert(s: &str); } #[wasm_bindgen] pub fn greet(name: &str) { alert(&format!("Hello, {:?}!", name)) }
Then running npm run serve, gives the following error in the browser's console:
npm run serve
TypeError: can't access property "__wbindgen_malloc", _index_bg_wasm__WEBPACK_IMPORTED_MODULE_0__ is undefined
Oddly enough, the following for index.js does appear to show the alert, but does nothing with the passed string to fn greet():
fn greet()
import * as wasm from "./pkg/index_bg.wasm"; async function main() { wasm.greet("42"); } main();
A minimal, reproducible example and used dependencies can be found here:
I've tried both Firefox 87.0b9 (64-bit) and Google Chrome 89.0.4389.90 (64-bit).
Thank you for your time.
The text was updated successfully, but these errors were encountered:
I'm having the exact same issue!
Sorry, something went wrong.
I managed to fix the issue by using an earlier version of webpack.
"webpack": "^4.29.4", "webpack-cli": "^3.1.1"
This is probably an issue with webpack
No branches or pull requests
Hi,
I've been trying to get the example to work, but I'm receiving an error that I haven't been able to solve. I must have overlooked something.
Taking the example from the documentation:
index.js
lib.rs
Then running
npm run serve
, gives the following error in the browser's console:Oddly enough, the following for
index.js
does appear to show the alert, but does nothing with the passed string tofn greet()
:A minimal, reproducible example and used dependencies can be found here:
I've tried both Firefox 87.0b9 (64-bit) and Google Chrome 89.0.4389.90 (64-bit).
Thank you for your time.
The text was updated successfully, but these errors were encountered: