https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
s

Sam Garfinkel

09/03/2019, 7:51 PM
How can I configure a multiplatform JVM target to use a sibling JS target (maybe through the JsJar task?). My jvm target consists of a Ktor webserver which will serve some static JS generated by the JS target. I guess these could be separated into independent projects, but the JS target really only makes sense when served by the jvm target so I wanted to couple them together
d

Dominaezzz

09/03/2019, 9:08 PM
Depends on what you mean by "use". Otherwise that task is indeed the way to go. You can use it to setup a copy task to put the build artefacts where you need them and setup a dependency for the jvm build task.
b

Big Chungus

09/04/2019, 7:12 AM
I'd recommend configuring jsJar to put all static content in some folder within the jar and then expand it into "fat" JVM jar. From ktor, then serve that folder as static resources
s

Sam Garfinkel

09/05/2019, 3:01 PM
@Big Chungus Instead I decided to use the webjars packaging, alongside the webpackTask, which allows me to serve it from basically any JVM backend (I'm using Ktor with build in support for webjars)
b

Big Chungus

09/05/2019, 3:02 PM
But you're still gonna have massive js bundle
this solves nothing, i'm affraid
oh, different thread. nvm
3 Views