Skip to content
New issue

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

Uncaught (in promise) TypeError: WebAssembly.instantiate(): Import #7 module="__wbindgen_placeholder__" error: module is not an object or function #14

Open
Boscop opened this issue Jan 27, 2020 · 2 comments
Labels
question Further information is requested

Comments

@Boscop
Copy link

Boscop commented Jan 27, 2020

When I try to use console_error_panic_hook in my yew project, my app panics on std::panic::set_hook(box console_error_panic_hook::hook) with:

Uncaught (in promise) TypeError: WebAssembly.instantiate(): Import #7 module="wbindgen_placeholder" error: module is not an object or function

I have the following [dependencies]:

yew = "0.11"
wasm-bindgen = "0.2"
console_error_panic_hook = "0.1.6"
#[wasm_bindgen(start)]
pub fn main_js() {
	#[cfg(debug_assertions)]
	std::panic::set_hook(box console_error_panic_hook::hook);
	web_logger::init();
	yew::initialize();
	App::<Model>::new().mount_to_body();
	yew::run_loop();
}

fn main() {
	main_js();
}
@Boscop Boscop added the question Further information is requested label Jan 27, 2020
@drewcrawford
Copy link

Although I did not use this crate, I was able to resolve this issue by implementing a similar panic hook in stdweb:

#[macro_use]
extern crate stdweb;

fn main() {
    panic::set_hook(Box::new(|p| {
        let s = p.to_string();
        js!{ console.error(@{s});}
    }));
}

@watzon
Copy link

watzon commented Jul 19, 2021

I get this same error when attempting to use wasm_bindgen::throw_str.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants