oxiadenine / kotlin-js-wrappers

Kotlin JS wrappers for popular JavaScript libraries

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unresolved reference: antd

alexShvetsPnz opened this issue · comments

Hi. Please help me.
I am not a very experienced developer and I am trying to create a simple project to explore the possibilities of Kotlin multiplatform
When I try to use your framework, i get the following error:

> Task :client:compileKotlinJs FAILED
e: /home/user/freedom/chalenge/kotlin-full-stack-application-demo/client/src/main/kotlin/components/Vertical.kt: (3, 8): Unresolved reference: antd
e: /home/user/freedom/chalenge/kotlin-full-stack-application-demo/client/src/main/kotlin/components/Vertical.kt: (9, 26): Unresolved reference: MenuClickEventHandler
e: /home/user/freedom/chalenge/kotlin-full-stack-application-demo/client/src/main/kotlin/components/Vertical.kt: (9, 52): Cannot infer a type for this parameter. Please specify it explicitly.

FAILURE: Build failed with an exception.

I only copied your sample

import antd.menu.MenuClickEventHandler
import react.RBuilder
import styled.css
import styled.styledDiv


private val handleClick: MenuClickEventHandler = { info ->
    console.log("click ", info)
}

fun RBuilder.vertical() {
    styledDiv {
        css { +MenuStyles.vertical }
    }
}

my build.gradle.kts for js code in multyplatform project:

plugins {
    kotlin("js")
}

val kotlinxHtmlVersion = "0.7.2"
val kotlinxSerializationVersion = "1.0.0-RC"
val kotlinxCoroutinesVersion = "1.3.9" 
val kotlinWrappersSuffix = "pre.148-kotlin-1.4.30"

kotlin {
    js {
        useCommonJs()
        browser {
        }
        binaries.executable()
    }
}

dependencies {
    implementation("org.jetbrains.kotlin:kotlin-stdlib-js")

    implementation("org.jetbrains.kotlinx:kotlinx-serialization-core-js:$kotlinxSerializationVersion")
    implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core-js:$kotlinxCoroutinesVersion")

    implementation(project(":shared"))

    implementation(npm("core-js", "2.6.5"))
    implementation(npm("svg-inline-loader", "0.8.0"))
    implementation("org.jetbrains.kotlinx:kotlinx-html:$kotlinxHtmlVersion")
    implementation("org.jetbrains:kotlin-react:17.0.1-$kotlinWrappersSuffix")
    implementation(npm("react", "17.0.1"))
    implementation(npm("react-dom", "17.0.1"))
    implementation(npm("react-is", "17.0.1"))
    implementation("org.jetbrains:kotlin-react-dom:17.0.1-$kotlinWrappersSuffix")
    implementation("org.jetbrains:kotlin-styled:5.2.1-$kotlinWrappersSuffix")
    implementation("org.jetbrains:kotlin-extensions:1.0.1-$kotlinWrappersSuffix")
    implementation("org.jetbrains:kotlin-css:1.0.0-$kotlinWrappersSuffix")
    implementation(npm("styled-components", "4.3.2"))
    implementation("org.jetbrains:kotlin-react-router-dom:5.2.0-pre.148-kotlin-1.4.30")
    implementation("com.github.samgarasx:kotlin-antd:4.8.6-pre.5-kotlin-1.4.30")
    implementation(npm("antd", "4.8.6"))
}

tasks.named("run") {
    dependsOn(":server:prepareDevServer")
}

I would be very grateful if you take the time to help me connect your project.

Hi, please check in gradle.properties if you are using IR compiler in both or ir mode, because legacy mode is only supported at the moment

New IR compiler is currently supported, so please update wrapper version and check it