Has anyone managed to get Kotlin wasmjs output to ...
# webassembly
l
Has anyone managed to get Kotlin wasmjs output to run in a browser webworker engine? If so, is there some documentation on how to do it?
m
Could you be a little bit more specific about what you actually want to achieve?
l
Right now I have a rather large piece of Kotlin code (a language interpreter) that I compile to js. The frontend then loads the interpreter into a webworker so that the code can run there without blocking the main js thread.
This is the interpreter by the way: https://kapdemo.dhsdevelopments.com/clientweb2/
Now, I am able to compile the interpreter to wasmjs, that part works fine. But I cannot load it into a webworker due to the way the js integration is done (it tries to eval some js code, which doesn't work in wasm)
The issue isn't with the generated wasm, but rather with the javascript harness that is generated by the compiler. Loading the wasm without that harness fails, because a lot of required functions are missing.
💡 1
says it is fixed in Kotlin 2.0.20; are you finding that not to be the case?
l
It's been a while since I tested it. It could be that it was before 2.0.20. I'll have to check the git log.
I was asking the question, because I rolled all the code back so I'd have to start working on the wasm port again from scratch, and I don't want to do that unless I can be reasonably sure it'll work.
Thanks for the information. I'll investigate this.