Skip to content

Commit 105fbf3

Browse files
committed
Reuse webMain instead of recreating it
Kotlin 2.2’s default hierarchy creates `webMain` when both JS and WASM targets are present. Re-creating it manually fails with the error “KotlinSourceSet with name 'webMain' already exists”.
1 parent 63b0044 commit 105fbf3

File tree

2 files changed

+507
-384
lines changed

2 files changed

+507
-384
lines changed

buildSrc/src/main/kotlin/targets.gradle.kts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,7 @@ fun KotlinMultiplatformExtension.configureCommonTargets() {
7070
}
7171

7272
sourceSets {
73-
val webMain by creating {
74-
dependsOn(commonMain.get())
75-
}
76-
jsMain {
77-
dependsOn(webMain)
78-
}
79-
wasmJsMain {
80-
dependsOn(webMain)
81-
}
73+
val webMain by getting
8274

8375
jvmTest.dependencies {
8476
implementation(kotlin("test-junit"))

0 commit comments

Comments
 (0)