If I'm making a Kotlin/JS library that needs to ha...
# javascript
d
If I'm making a Kotlin/JS library that needs to have a web worker component to it, is there any simple way to ship the library so that the main js compilation and the web worker script are both available to library consumers in some way?
b
No, because you'd need your worker code in a separate js file. One way to do it is to ship your worker code as an npm dependency published to npm (see how kvision-assets does it)
👍 1
t
a
That's convenient. I just tried something similar. I made a blog post about it. You need two separate compilations. But you can use shared code of course. https://avwie.github.io/multithreaded-web-applications-in-kotlin-with-web-workers