I’ve been enjoying writing libraries in C and being able to use them both from native applications and in web apps via WASM. I personally avoid emscripten and just implement the minimal C/JS glue and utilities myself.
[1] https://github.com/nothings/stb/blob/master/stb_sprintf.h