hey guys, I am trying to run (jsBrowserRun) fallin...
# compose-web
r
hey guys, I am trying to run (jsBrowserRun) falling-balls example from compose-multiplatform example but it fails resolving these imports:
Copy code
import androidx.compose.ui.window.Window
import org.jetbrains.skiko.wasm.onWasmReady
any idea what am i missing?
j
Copy code
package com.jamshedalamqaderi.fmadmin.web

import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.window.CanvasBasedWindow
import com.jamshedalamqaderi.fmadmin.shared.presentation.FMAdminApp
import org.jetbrains.skiko.wasm.onWasmReady

@OptIn(ExperimentalComposeUiApi::class)
fun main() {
    onWasmReady {
        CanvasBasedWindow("FM Admin") {
//            FMAdminTheme {
//                ComposeRouter {
//                    routeView("/") {
//                        HomeScreen()
//                    }
//                }
//            }
            FMAdminApp()
        }
    }
}
do like the above. this is a real world project that i'm working on it
r
can you share you build.gradle for :web module ?
j
Copy code
import com.android.build.api.dsl.Optimization
import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpackConfig

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

kotlin {
    js(IR) {
        moduleName = "fmadmin-web"
        browser {
            commonWebpackConfig(Action {
                devServer = (devServer ?: KotlinWebpackConfig.DevServer()).copy(
                    static = (devServer?.static ?: mutableListOf()).apply {
                        // Serve sources to debug inside browser
                        add(project.rootDir.path)
                        add(project.rootDir.path + "/shared/")
                        add(project.rootDir.path + "/web/")
                    },
                )
            })
        }
        binaries.executable()
    }

    sourceSets {
        val jsMain by getting {
            dependencies {
                implementation(project(":shared"))
            }
        }
    }
}

compose.experimental {
    web.application {}
}
r
still geting same errors ;/
j
could you share your build and setting file?
also gradle.properties as well
r
j
what is your java version?
r
java 18.0.2.1 2022-08-18
j
ok. let me check by running on my pc
r
thanks!
ok i have added: implementation(compose.runtime) implementation(compose.ui) implementation(compose.foundation) implementation(compose.material) to jsApp/build.gradle.kts and now it runs fine
🙌 1
but its a shame that the example in compose-multiplatform project does not compile
or maybe i missed something else in my config
j
in the shared module if this was
api
instead of implementation then you won't need to implement them again in platform module
r
yes, i turned it to api now
and its fine 🙂
✅ 1
thank you for your help 🙂