Closed schell closed 2 years ago
I've run into an interesting bug where attempting to run a wasm32-compiled program with fastrand in it gives this error in the console:
fastrand
Uncaught TypeError: Error resolving module specifier “env”. Relative module specifiers must start with “./”, “../” or “/”.
I'm using fastrand = "1.8.0"
fastrand = "1.8.0"
I encountered this after adding futures-lite to my project, which depends on fastrand. https://github.com/rustwasm/wasm-bindgen/issues/2215 explains a few reasons why this error might pop up.
futures-lite
I got around this problem by using futures_lite::StreamExt::or instead of futures_lite::StreamExt::race. race uses fastrand::bool, whereas or does not.
futures_lite::StreamExt::or
futures_lite::StreamExt::race
race
fastrand::bool
or
Duplicate of #27
Note that if you compile and run the program in a WASI environment, it should all work out.
I've run into an interesting bug where attempting to run a wasm32-compiled program with
fastrand
in it gives this error in the console:I'm using
fastrand = "1.8.0"
I encountered this after adding
futures-lite
to my project, which depends onfastrand
. https://github.com/rustwasm/wasm-bindgen/issues/2215 explains a few reasons why this error might pop up.I got around this problem by using
futures_lite::StreamExt::or
instead offutures_lite::StreamExt::race
.race
usesfastrand::bool
, whereasor
does not.