I made a demo that shows how to use webworkers in Kotlin/JS: https://github.com/ethanmdavidson/KotlinJSWebWorkerDemo
It involves building multiple .js files, which is also something I've seen people asking about. Check it out and let me know what you think!
🔥 2
t
turansky
05/20/2021, 10:20 PM
1. 🔥
2.
kotlinx-html
0.7.3
available in maven central
3. Do you use
webpack-loader
? I use such configuration (different for production and dev)
4. I don’t “dependecies” between targets. Is it possible?
e
Ethan Davidson
05/21/2021, 1:08 AM
1 & 2: Thanks!
3: No, I've never messed around with webpack at all, but I think you should be able to add any configuration to both worker and client. btw is this example also using webworkers?
4. Yes, it's possible to share dependencies between targets by adding it to a common ancestor. I've updated the demo to show this by having commonMain depend on kotlinx-serialization, which allows client and worker to pass objects back and forth.
t
turansky
05/21/2021, 1:44 AM
3: No, I’ve never messed around with webpack at all, but I think you should be able to add any configuration to both worker and client.
I use Gradle plugins (KFC plugins) for automatic webpack configuration.
Loader will be applied automatically, if you build application