This way is easier as no extra but emcc required.
Simply following Step1 part of
https://github.com/treeform/nim_emscripten_tutorial
A more detailed version than the one above
https://github.com/bitnom/nim-to-wasm-guide
And you’ve get Nim running in Browser other than as JS (I’d mention Nim natively supports compiling to JS)
emcc’s commandline options(in fact will to linker):
-s EXPORT_ALL=1-s EXPORT_FUNCTIONS=_f1,... → export f1 (NOTE the beginning underscore) (bc. emcc mangles exported symbols. ref https://emscripten.org/docs/porting/connecting_cpp_and_javascript/Interacting-with-code.html#call-compiled-c-c-code-directly-from-javascript)EMSCRIPTEN_KEEPALIVE from <emscripten.h> (I tried but Nim compiler report errors, so I prefer method #3…)