-
-
Notifications
You must be signed in to change notification settings - Fork 474
Closed
Labels
F-new-extFunctionality: new, outside of RandFunctionality: new, outside of RandP-postponeWaiting on something elseWaiting on something else
Milestone
Description
Glad to see that rand is adding wasm support. However using wasm_bindgen to build towards nodejs we get a build artifact with an unknown require('env')
The make file to run the building is:
build-wasm-dev:
cargo build --target wasm32-unknown-unknown; \
mkdir -p dist; \
wasm-bindgen target/wasm32-unknown-unknown/debug/ditto.wasm --out-dir ./dist --nodejs
And the created file looks like this:
let imports = {};
imports['./ditto'] = require('./ditto');
imports['env'] = require('env'); // HERE, what is this?
const join = require('path').join;
const bytes = require('fs').readFileSync(join(__dirname, 'ditto_bg.wasm'));
const wasmModule = new WebAssembly.Module(bytes);
const wasmInstance = new WebAssembly.Instance(wasmModule, imports);
module.exports = wasmInstance.exports;
Therefore running in node throws an unknown env
module error.
This seems to only happen when my Cargo.toml includes:
rand = {version = "0.5.0", features = ['stdweb']}
Metadata
Metadata
Assignees
Labels
F-new-extFunctionality: new, outside of RandFunctionality: new, outside of RandP-postponeWaiting on something elseWaiting on something else