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

Zachary Wander

02/28/2024, 4:11 PM
Hey everyone. I’m trying to create a common source set for JS and Wasm in a Compose project, but both IntelliJ and Android Studio don’t seem to recognize the common libraries/APIs, like
kotlinx.browser
. Building works fine, but the editor itself shows unresolved reference errors and I don’t have code completion/inspection. Looking around the internet, it seems like this should work, but I don’t really know where to go from here. This is my
sourceSets
block:
Copy code
sourceSets {
        val commonMain by getting {
            dependencies {
                implementation(compose.runtime)
                implementation(compose.foundation)
                implementation(compose.material3)
                implementation(compose.ui)
                implementation(compose.components.resources)
            }
        }

        val skikoMain by creating {
            dependsOn(commonMain)
        }

        val jsWasmMain by creating {
            dependsOn(skikoMain)
        }

        val jsMain by getting {
            dependsOn(jsWasmMain)
        }

        val wasmJsMain by getting {
            dependsOn(jsWasmMain)
        }
    }
7 Views