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)

Export Symbols

emcc’s commandline options(in fact will to linker):

Call Exported Function in JS