leandro
02/09/2020, 1:32 PMkotlin2js
& org.jetbrains.kotlin.frontend
to the new org.jetbrains.kotlin.js
plugin. Re-writing my :web
module to be the same as the newly released version for "Building Web Applications with React and Kotlin/JS" worked well, and now I want to make use of another module inside the same project. Previously, in my build.gradle
, I had the following declaration:
apply plugin: 'kotlin2js'
apply plugin: 'org.jetbrains.kotlin.frontend'
dependencies {
compile project(':api')
//...
}
and now I have, on my `build.gradle.kts`:
plugins {
id("org.jetbrains.kotlin.js")
}
group = "org.example"
version = "1.0-SNAPSHOT"
dependencies {
implementation(project(":api"))
//...
}
As I try to run ./gradlew :web:browserDevelopmentRun
, I get the error
project ':api' is not configured for JS usage
Previously it was working fine. My :api
build.gradle
is as follows:
apply plugin: 'org.jetbrains.kotlin.multiplatform'
apply plugin: 'kotlinx-serialization'
archivesBaseName = 'api'
kotlin {
js {
compilations.main.kotlinOptions {
moduleKind = 'umd'
}
}
sourceSets {
commonMain {
dependencies {
api deps.kotlin.stdlib.common
api deps.kotlin.coroutines.common
api project(':backend:model')
implementation deps.kotlin.serialization.common
}
}
jsMain {
dependencies {
api deps.kotlin.stdlib.js
api deps.kotlin.coroutines.js
api deps.kotlin.serialization.js
}
}
}
}
leandro
02/09/2020, 1:33 PMIlya Goncharov [JB]
02/09/2020, 1:54 PMbrowser
or nodejs
suntergat in your api
module
kotlin {
js {
nodejs() // for example
}
}
leandro
02/09/2020, 2:17 PMbrowser()
to every single module that was multiplatform and declared the js{}
block.Ilya Goncharov [JB]
02/09/2020, 3:45 PMjs{}
in compatibility aims
But for mpp you should to declare browser
or nodejs
explicitly
It additionally setup test environment