Project won't compile emscripten code

It’s a bit late but I stumbled across this question this post while trying to solve a similar problem so I thought I’d share my solution: Js/c++ communication - Platform & Builds - Epic Developer Community Forums

Only tested it with UE 4.12