-
Notifications
You must be signed in to change notification settings - Fork 247
Closed
Description
Currently wasm-pack has two common build options:
nodejsproduces a commonjs module for nodewebproduces an es6 module for the web
I'd like to use the same wasm module (published in npm) isomorphically for both nodejs and the web. It almost works - but unfortunately getrandom (run from nodejs) doesn't work at all in an es6 context. It produces this code in a esm file:
imports.wbg.__wbg_modulerequire_0a83c0c31d12d2c7 = function() { return handleError(function (arg0, arg1) {
var ret = module.require(getStringFromWasm0(arg0, arg1));
return addHeapObject(ret);
}, arguments) };
... Which errors, because module is not defined in this context.
I'm not sure how getrandom should work around this. Any thoughts?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels