Following a few posts I was able to get Crystal to compile to WASM with wasi. From what I understand, WASI is just the basic WASM without any Javascript stuff added. It sounds like in order to get WASM actually in the web, it needs to target emscripten?
Has anyone had success doing this?
> crystal build sum.cr -o sum.wasm --target wasm32-emscripten
In /usr/share/crystal/src/string.cr:1:1
1 | require "c/stdlib"
^
Error: can't find file 'c/stdlib'
I tried to changing the target, but get some missing libs. I know for the WASI stuff, I needed to build GitHub - lbguilherme/wasm-libs and copy the wasi libs over. I assume I’m missing something for doing emscripten, but I’m not sure what.
I also have wasmer installed, but didn’t see any docs on converting the format over (if that’s even a thing)… My goal is to use WebAssembly.instantiateStreaming() - WebAssembly | MDN and access WASM functions from javascript.