Hi! I’m trying to connect my JS code with JVM serv...
# multiplatform
p
Hi! I’m trying to connect my JS code with JVM server side but with no luck. I have a usual project structure with
androidApp
,
iosApp
,
shared
,
backend
and
web
modules. My ktor
backend
server returns index.html:
Copy code
routing {
    staticResources("/", "static") {
        default("index.html")
    }...
Everything works fine. But how can I use index.html, other static content and generated
web.js
file from my
web
module? More details are in the thread.
I suppose I should pack my JS content into a jar with something like this:
Copy code
tasks.getByName<Jar>("jvmJar") {
    val taskName = if (project.hasProperty("isProduction")
        || project.gradle.startParameter.taskNames.contains("installDist")
    ) {
        "jsBrowserProductionWebpack"
    } else {
        "jsBrowserDevelopmentWebpack"
    }
    val webpackTask = tasks.getByName<KotlinWebpack>(taskName)
    dependsOn(webpackTask) // make sure JS gets compiled first
    from(File(webpackTask.destinationDirectory, webpackTask.outputFileName)) // bring output file along into the JAR
}
but what’s the next step? Can anyone share the code how share content between
web
and
backend
modules?