https://kotlinlang.org logo
#compose-web
Title
# compose-web
s

Sebastien Leclerc Lavallee

04/21/2022, 4:31 PM
Hello! I want to add compose web to my existing KMP project but the problem is that I’m already using Kotlin 1.6.20. Currently, the compose setup set the Jetbrain’s compose plugin to 1.1.1 (
id("org.jetbrains.compose") version "1.1.1"
). I think I got this from a tutorial or wizard in IntelliJ. Now I know that compose 1.1.1 does not support Kotlin 1.6.20. But I saw last week that a new version of the compose compiler alpha version (
1.2.0-alpha08
) does now support Kotlin 1.6.20. But how do I get to force the compiler version ? Will it even work since the compiler is the one provided by Google and not the Jetbrain’s one which support compose web. Or are there any difference?!
build.gradle.kts
setup in thread. Thanks for clarifications 😅
Copy code
import org.jetbrains.compose.compose

plugins {
  kotlin("multiplatform")
  id("org.jetbrains.compose") version "1.1.1"
}

group = "com.test.web"
version = "0.0.1"

kotlin {
  js(IR) {
    browser {
      testTask {
        testLogging.showStandardStreams = true
        useKarma {
          useChromeHeadless()
          useFirefox()
        }
      }
    }
    binaries.executable()
  }

  sourceSets {
    val jsMain by getting {
      dependencies {
        implementation(compose.web.core)
        implementation(compose.runtime)
      }
    }
    val jsTest by getting {
      dependencies {
        implementation(kotlin("test-js"))
      }
    }
  }
}
k

Kirill Grouchnikov

04/21/2022, 4:42 PM
h

hfhbd

04/21/2022, 4:56 PM
BTW
0.0.0-on-rebase-12-apr-2022-dev670
compiles with 1.6.20, but it is not an official release, not even an alpha release
s

Sebastien Leclerc Lavallee

04/21/2022, 4:57 PM
@Kirill Grouchnikov thanks for the link! So my understanding is that both compose are totally unrelated. And I should follow compose-jb repo for those release And thanks for the precision @hfhbd I'll try and see how it goes
h

hfhbd

04/21/2022, 4:58 PM
Yes.
1.2.0-alpha08
is Googles Android Compose version, which differs from Compose Multiplatform by JetBrains
If you really want to test snapshot builds with 1.6.20, you could use build number 670+: https://maven.pkg.jetbrains.space/public/p/compose/dev/org/jetbrains/compose/web/web-core/ But again, these snapshots are not releases and are not properly tested. For prototyping and learning compose, I would use a playground project with the official releases.
s

Sebastien Leclerc Lavallee

04/21/2022, 6:03 PM
So build number more than 670 should include the on-rebase-12-april-2022-dev670 rebase? 🤔 Let’s say the latest
0.0.0-master-dev673
should also work on 1.6.20 ?
j

John O'Reilly

04/21/2022, 6:09 PM
fwiw I've tested that version here with Compose for Desktop, Web and iOS (with Kotlin 1.6.20) and seems to work fine (changes pushed to following....will update it once more stable version available https://github.com/joreilly/PeopleInSpace )
h

hfhbd

04/21/2022, 8:25 PM
Yes
s

Sebastien Leclerc Lavallee

04/21/2022, 8:29 PM
Did try with
0.0.0-master-dev673
and working fine for now for my setup. I’ll continue to check compose web but at least it’s compiling which is what I wanted. Thanks for the help!
p

phuc.tran

04/22/2022, 1:40 AM
Hey @Sebastien Leclerc Lavallee I’m trying to add web to my project too. Can you share the steps to do that?
s

Sebastien Leclerc Lavallee

04/22/2022, 2:20 AM
@phuc.tran I did create a separate new project, Kotlin / Compose Web and copied it as a module inside my current project
p

phuc.tran

04/22/2022, 2:46 AM
thanks @Sebastien Leclerc Lavallee for sharing
s

Sebastien Leclerc Lavallee

04/22/2022, 2:49 AM
@phuc.tran Pleasure 🙂
19 Views