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

ian.shaun.thomas

10/19/2023, 5:27 PM
Just wanted to leave this as a note for anyone else running into a similar situation. I need to build multiple browser targets in a setup like
Copy code
kotlin {
  js { browser() }
  js ("targetA") { 
    browser()
    binaries.executable()
  }
  js ("targetB") { 
    browser()
    binaries.executable()
  }
  sourceSets {
    val targetAMain by getting {
      dependsOn(jsMain)
    }
    val targetBMain by getting {
      dependsOn(jsMain)
    }
  }
}
The issue I was having is that when attempting to apply compose you get a warning about multiple IR targets and to specify the targets with
compose.web.targets()
and I unfortunately could not find any examples of how to manually specify the targets. It ended up being simple but if anyone has an easier way to do this I'm happy to adopt it.
Copy code
compose {
    web.targets(
        *kotlin.targets
            .asMap
            .values
            .filterIsInstance(KotlinJsIrTarget::class.java)
            .toTypedArray()
    )
}
2 Views