After lots of struggling with emscripten, I made a server-side sandbox instead.