Closed
Description
Code:
> cat .\src\lib.rs
#![feature(proc_macro, wasm_import_module, wasm_custom_section)]
extern crate wasm_bindgen;
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
extern {
fn alert(s: &str);
}
#[wasm_bindgen]
pub fn greet(name: &str) {
alert(&format!("Hello, {}!", name));
}
Cargo.toml:
[package]
name = "wasmpacktest"
version = "0.1.0"
authors = ["steveklabnik <steve@steveklabnik.com>"]
[lib]
crate-type = ["cdylib"]
[dependencies]
wasm-bindgen = "0.2"
When I invoke wasm-bindgen through wasm-pack...:
> wasm-pack init
[1/8] Checking crate configuration...
[2/8] Adding WASM target...
[3/8] Compiling to WASM...
[4/8] Creating a pkg directory...
[5/8] Writing a package.json...
:-) [WARN]: Field description is missing from Cargo.toml. It is not necessary, but recommended
:-) [WARN]: Field repository is missing from Cargo.toml. It is not necessary, but recommended
:-) [WARN]: Field license is missing from Cargo.toml. It is not necessary, but recommended
[6/8] Copying over your README...
:-) [WARN]: origin crate has no README
[7/8] Installing WASM-bindgen...
| [8/8] Running WASM-bindgen...
wasm-bindgen failed to execute properly. stderr:
thread 'main' panicked at 'failed to run export: Function("Module doesn\'t have export __wbindgen_describe___wbg_f_alert_alert_n")', libcore\result.rs:945:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.
rustc version:
> rustc --version
rustc 1.28.0-nightly (01cc982e9 2018-06-24)
Any ideas what's wrong here?