For me it was much more simple but it took me a while to figure it out. We basically had in our .jslib
some_array.forEach(item => {
do_stuff(item);
});
Turns out Unity (emscripten?) just doesn't like that syntax. We replaced it with a good old for-loop and it stoped complaining right away. I really hate it that it doesn't show the line it is complaining about, but anyway, fool me twice shame on me.