I am trying to write a UI component, which can be used from Compose Desktop and Android as well as from Compose Web by using the actual/expect pattern in common code. I then provide two implementations, one for Android & JVM/Desktop, the other for Web.
To achieve this, I added a jsMain and a nonJsMain source set (which desktopMain and androidMain depend on) to the Compose Multiplatform template provided by IntelliJ. However, IntelliJ marks usages of @Composable, etc. as an error in the nonJsMain source set. The demo application which uses the code builds and runs fine.
A workaround is to remove dependsOn(nonJsMain) in the androidMain source set while coding and adding it again when building.
I am trying to write a UI component, which can be used from Compose Desktop and Android as well as from Compose Web by using the actual/expect pattern in common code. I then provide two implementations, one for Android & JVM/Desktop, the other for Web.
To achieve this, I added a jsMain and a nonJsMain source set (which desktopMain and androidMain depend on) to the Compose Multiplatform template provided by IntelliJ. However, IntelliJ marks usages of @Composable, etc. as an error in the nonJsMain source set. The demo application which uses the code builds and runs fine.
A workaround is to remove dependsOn(nonJsMain) in the androidMain source set while coding and adding it again when building.
You can find the gradle file here: https://github.com/antoniusnaumann/arc-slider/blob/655309a1ad92eeff6178071988f969a4349ab530/common/build.gradle.kts#L54
Relevant project branch: https://github.com/antoniusnaumann/arc-slider/tree/bugfix/compose-mulitplatform-sourcesets