Hi,
I played with hands on lab on kotlin and react Kotlin Playground: Edit, Run, Share Kotlin Code Online
(repo: GitHub - kotlin-hands-on/web-app-react-kotlin-js-gradle)
now I just made it a gradle multiproject and things stop to work:
mkdir frontend
mv build.gradle.kts frontend/
mv src frontend/
mv src/main src/jsMain
and adjusted settings.gradle.kts
to include("frontend")
used kotlin("multiplatform") version "1.4.21"
and konsistent setup for it
and the html with <script src="confexplorer-frontend.js"></script>
gets a 404 “confexplorer-frontend.js” not found.
my complete code at: GitHub - HoffiMuc/web-app-react-kotlin-js-gradle: clone of https://github.com/kotlin-hands-on/web-app-react-kotlin-js-gradle
Is there a standard way to adjust things in the subproject's build.gradle.kts ?
or am I basically doing something wrong here?
complete frontend/build.gradle.kts
looks like:
plugins {
kotlin("multiplatform") version "1.4.21"
}
group = "org.example"
version = "1.0-SNAPSHOT"
repositories {
maven { setUrl("https://dl.bintray.com/kotlin/kotlin-eap") }
maven("https://kotlin.bintray.com/kotlin-js-wrappers/")
mavenCentral()
jcenter()
}
kotlin {
js {
browser {}
binaries.executable()
}
sourceSets {
val jsMain by getting {
dependencies {
implementation(kotlin("stdlib-js"))
//React, React DOM + Wrappers (chapter 3)
implementation("org.jetbrains:kotlin-react:17.0.0-pre.132-kotlin-1.4.21")
implementation("org.jetbrains:kotlin-react-dom:17.0.0-pre.132-kotlin-1.4.21")
implementation(npm("react", "17.0.0"))
implementation(npm("react-dom", "17.0.0"))
//Kotlin Styled (chapter 3)
implementation("org.jetbrains:kotlin-styled:5.2.0-pre.132-kotlin-1.4.21")
implementation(npm("styled-components", "~5.2.1"))
implementation(npm("inline-style-prefixer", "~6.0.0"))
//Video Player (chapter 7)
implementation(npm("react-player", "~2.6.0"))
//Share Buttons (chapter 7)
implementation(npm("react-share", "~4.2.1"))
//Coroutines (chapter 8)
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9")
}
}
}
}