Search code examples
npmgithub-actionskotlin-jskotlin-js-interop

building kotlinJs app on github actions CI


I'm having some issues setting up github actions to build my kotlinJS project? i have the js runtime dependency:

implementation(npm("kotlinx-serialization-kotlinx-serialization-core-jslegacy", "1.4.2-RC1"))

and i get error:

Module 'kotlinx-serialization-kotlinx-serialization-core-jsLegacy' not found 
> Task :remote:jsBrowserDevelopmentWebpack

do i have to install npm (or some source) to make this work on github actions? or is there some github action i need to use to build kotlinJS on github actions?this is my github actions yaml - the js lib is built and copied to a jar as a resource https://github.com/sentinelweb/cuer/blob/ab00c7a7cd969eafa72b0d28bc5ba5c5c3e099d3/.github/workflows/android.yml

Below is the dependency tree - removing the jsMain dependency kotlinx-serialization-kotlinx-serialization-core-jslegacy results in a runtime / webpack error - So I am unsure where this dependecy is created in the kjs runtime - but possibly it has to be removed by using some other library. Just removing it breaks the runtime/webpack though

    val commonMain by getting {
            dependencies {
                implementation(project(":shared"))
                implementation("org.jetbrains.kotlinx:kotlinx-datetime:$ver_kotlinx_datetime")
                implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:$ver_kotlinx_serialization_core")
                implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:$ver_kotlinx_serialization_core")
                implementation("io.ktor:ktor-client-core:$ver_ktor")
                implementation("io.insert-koin:koin-core:$ver_koin")
            }
        }

        val jsMain by getting {
            dependencies {
                implementation("org.jetbrains.kotlinx:kotlinx-datetime-js:$ver_kotlinx_datetime")
                implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$ver_coroutines_core")
                implementation("org.jetbrains:kotlin-react:$ver_kotlin_react")
                implementation("org.jetbrains:kotlin-react-dom:$ver_kotlin_react")
                implementation("org.jetbrains:kotlin-styled:$ver_kotlin_styled")
                implementation(npm("react-youtube-lite", "1.0.1"))
                implementation(npm("react-share", "~4.2.1"))
                // todo shouldn't be need but breaks build runtime/webpack
                implementation(npm("kotlinx-serialization-kotlinx-serialization-core-jslegacy", "1.4.2-RC1"))

            }
        }

Solution

  • looks like this was due to an older version of kotlin-serialization dependency in kotlin-datetime updating to kotlin-datetime 0.2.1 fixed it