Webpack supports dynamic importing only for some special cases in which it is able to narrow down the set of packages to bundled. In the general case it just produces an empty (Webpack) context plus the warning stating that "the request of a dependency is an expression." Apparently the commit120a1d7fchanged the Javascript generated by wasm-bindgen so that the binding for the `require` became: ``` module.require(getStringFromWasm0(arg0, arg1)) ``` when it used to be: ``` getObject(arg0).require(getStringFromWasm0(arg1, arg2)) ``` In the latter case Webpack did not even realize that this code imported a package and, hence, did not try to bundle it. The new code triggers the bundling and because the dependency is fully dynamic Webpack has problems with it. This commit reverts partially the commit120a1d7fso that the generated binding obfuscates the `require` call enough to hide it from Webpack again.
getrandom
A Rust library for retrieving random data from (operating) system source. It is
assumed that system always provides high-quality cryptographically secure random
data, ideally backed by hardware entropy sources. This crate derives its name
from Linux's getrandom function, but is cross platform, roughly supporting
the same set of platforms as Rust's std lib.
This is a low-level API. Most users should prefer using high-level random-number
library like rand.
Usage
Add this to your Cargo.toml:
[dependencies]
getrandom = "0.2"
Then invoke the getrandom function:
fn get_random_buf() -> Result<[u8; 32], getrandom::Error> {
let mut buf = [0u8; 32];
getrandom::getrandom(&mut buf)?;
Ok(buf)
}
For more information about supported targets, entropy sources, no_std targets,
crate features, WASM support and Custom RNGs see the
getrandom documentation and
getrandom::Error documentation.
Minimum Supported Rust Version
This crate requires Rust 1.34.0 or later.
License
The getrandom library is distributed under either of
at your option.