wasm-pack
wasm-pack copied to clipboard
Critical dependency: the request of a dependency is an expression
🐛 Bug description
i write below code:
#[wasm_bindgen]
pub fn test() {
let tmp = client_random(28);
}
pub fn client_random(len: usize) -> Vec<u8> {
let mut data: Vec<u8> = vec![0; len];
let mut rng = rand::thread_rng();
for i in 0..len {
let n = match SystemTime::now().duration_since(SystemTime::UNIX_EPOCH) {
Ok(n) => n.as_millis(),
Err(_) => 100,
};
let ir = rng.gen_range(0..n as usize);
data[i] = ((n + ir as u128) % 256) as u8;
}
data
}
and use
🤔 Expected Behavior
👟 Steps to reproduce
npm run found error:
Critical dependency: the request of a dependency is an expression
🌍 Your environment
Include the relevant details of your environment. wasm-pack version: 0.10.0 rustc version: 1.53.0 (53cb7b09b 2021-06-17)
@weihualiu Hi, have you ever resolved this?
This repo is for Rust->WASM Perhaps you meant to file this for wasm-bindgen which is WASM->JS
https://github.com/rustwasm/wasm-bindgen/issues/2706