https://kotlinlang.org logo
#kvision
Title
# kvision
i

Ilya Tel

02/01/2023, 4:59 PM
Hello, first a small suggestion for improvement: I noticed that after the initialization of the application, the attributes disappear from the root container element. For example, someone might want to set the data-token="sometoken" attribute. ---------------------------------------------- Now the problem. I'm not sure if this is related to KVision. Instead of implementation("io.kvisionkvision rest$kvisionVersion") I tried using implementation("io.ktorktor client content negotiation js$ktor_version") implementation("io.ktorktor serialization kotlinx json js$ktor_version") Now when I do
./gradlew -t run
everything works fine, But when i do a
./gradlew clean zip
, then a certain part of my app breaks, with an undefined function (the function has a minimized name) message... 95% of the application works fine, but in one part, which in my opinion is no different from the rest, I get this error when I try to send a request If I do a
./gradlew zip
everything works fine Has anyone encountered this ? I will most likely revert to using kvision-rest soon, but I also thought it would be helpful to get your input on the issue. here's my build.gradle.kts
Copy code
import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpackConfig

plugins {
    val kotlinVersion: String by System.getProperties()
    kotlin("plugin.serialization") version kotlinVersion
    kotlin("js") version kotlinVersion
    val kvisionVersion: String by System.getProperties()
    id("io.kvision") version kvisionVersion
}

version = "1.0.0-SNAPSHOT"
group = "com.example"

repositories {
    mavenCentral()
    mavenLocal()
}

// Versions
val kotlinVersion: String by System.getProperties()
val kvisionVersion: String by System.getProperties()
val ktor_version: String by project

val webDir = file("src/main/web")

kotlin {
    js {
        browser {
            runTask {
                outputFileName = "main.bundle.js"
                sourceMaps = false
                devServer = KotlinWebpackConfig.DevServer(
                    open = false,
                    port = 3000,
                    proxy = mutableMapOf(
                        "/kv/*" to "<http://localhost:8080>",
                        "/kvws/*" to mapOf("target" to "<ws://localhost:8080>", "ws" to true)
                    ),
                    static = mutableListOf("$buildDir/processedResources/js/main")
                )
            }
            webpackTask {
                outputFileName = "main.bundle.js"
            }
//            testTask {
//                useKarma {
//                    useChromeHeadless()
//                }
//            }
        }
        binaries.executable()
    }
    sourceSets["main"].dependencies {
        implementation("io.kvision:kvision:$kvisionVersion")

        implementation("io.kvision:kvision-bootstrap:$kvisionVersion")
        implementation("io.kvision:kvision-i18n:$kvisionVersion")
        implementation("io.kvision:kvision-routing-navigo-ng:$kvisionVersion")
        implementation("io.kvision:kvision-state:$kvisionVersion")
        implementation("io.kvision:kvision-toastify:$kvisionVersion")
        implementation("io.kvision:kvision-imask:$kvisionVersion")

        implementation("io.ktor:ktor-client-content-negotiation-js:$ktor_version")
        implementation("io.ktor:ktor-serialization-kotlinx-json-js:$ktor_version")
    }
    sourceSets["test"].dependencies {
        implementation(kotlin("test-js"))
        implementation("io.kvision:kvision-testutils:$kvisionVersion")
    }
    sourceSets["main"].resources.srcDir(webDir)
}
r

Robert Jaros

02/01/2023, 5:03 PM
It's a problem with incremental compilation in Kotlin 1.8.0
But it could also be something else related to Ktor on JS
i

Ilya Tel

02/01/2023, 5:07 PM
Ooh, it looks like it. Okay, then I'll check again when the kotlin release comes out with a fix.
r

Robert Jaros

02/01/2023, 5:10 PM
As for the attributes of the root container - it's probably could be fixed. Please open an issue on Github.
8 Views