Skip to content

Commit 8fad7c5

Browse files
committed
js: Add comment explaining why we do this hack
Signed-off-by: Joe Richey <[email protected]>
1 parent 8372c16 commit 8fad7c5

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/js.rs

+3
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ extern "C" {
104104
#[wasm_bindgen(method, js_name = getRandomValues, catch)]
105105
fn get_random_values(this: &BrowserCrypto, buf: &Uint8Array) -> Result<(), JsValue>;
106106

107+
// We use a "module" object here instead of just annotating require() with
108+
// js_name = "module.require", so that Webpack doesn't give a warning. See:
109+
// https://github.com/rust-random/getrandom/issues/224
107110
type NodeModule;
108111
#[wasm_bindgen(js_name = module)]
109112
static NODE_MODULE: NodeModule;

0 commit comments

Comments
 (0)