sandspiel
sandspiel copied to clipboard
Error importing `index.js`: RuntimeError: unreachable
After building this locally from source the webgl frame stays black and i get this error.
Error importing `index.js`: RuntimeError: unreachable
at __rust_start_panic (wasm-function[561]:1)
at rust_panic (wasm-function[560]:30)
at std::panicking::rust_panic_with_hook::h734f34ceefcf033c (wasm-function[557]:444)
at std::panicking::continue_panic_fmt::h66e52772c6d4be59 (wasm-function[556]:120)
at rust_begin_unwind (wasm-function[555]:3)
at core::panicking::panic_fmt::h0c93626b89c38af6 (wasm-function[592]:70)
at core::panicking::panic::h158c6e3285d6c3fb (wasm-function[591]:100)
at sandtable::Universe::update_cell::h5d2fdc89fb495a84 (wasm-function[332]:263)
at sandtable::Universe::tick::h8ad457e7c2a85e9c (wasm-function[344]:2052)
at universe_tick (wasm-function[353]:155)
Tried to remove built files and rebuild. Even did a fresh clone without success.
Any help appreciated. Thanks.
I get this too, it's some weird race condition with the tools, try to re-run wasm-pack build
after the webpack dev server is running, which should fix it
That's a workaround but we should keep this issue open to find a fix, thanks for opening
Oh wow, that little weird detail fixed it for now. Thanks.
UPD2: everything below is wrong, target architecture has nothing to do with it.
However after I wasm-pack build
the folder "target/release" appears. Maybe npm run start
builds the crate in debug mode?
original comment
The problem is target architecture. Npm dev server by default builds for wasm32-unknown-unknown, which cannot do random numbers. When you make wasm-pack build
the server is being built for wasm32-unknown-emscripten which handles getting random numbers fine.
UPD: i removed all random-calling code and it still fails so I am not sure it is related to random
being called, but it definetly works with emscripten backend