kotlinx-datetime
kotlinx-datetime copied to clipboard
JS browser app fails to load due to missing js-joda module
Repro: https://github.com/slackhq/circuit (under the samples/counter/apps dir) and run ./gradlew jsBrowserRun
kotlinx-datetime version: 0.4.0 when transitively depended on via compose-multiplatform. Same issue if directly depended on and with 0.5.0
kotlin version: 1.9.22
Error:
Uncaught Error: Error loading module 'circuit-root.samples.counter:apps'. Its dependency '@js-joda/core' was not found. Please, check whether '@js-joda/core' is loaded prior to 'circuit-root.samples.counter:apps'.
<anonymous> http://localhost:8080/counterapp.js:88
<anonymous> http://localhost:8080/counterapp.js:92
[counterapp.js:88:13](http://localhost:8080/counterapp.js)
<anonymous> http://localhost:8080/counterapp.js:88
<anonymous> http://localhost:8080/counterapp.js:92
I'm not sure if this is a bug with KMP or compose or this library, but figured I should start here.
A similar issue was filed and marked as fixed in 1.8 here, but seems to be regressed: https://youtrack.jetbrains.com/issue/KT-45789
For me I got unsupported zoneid
error on wasm compose-multiplatform with kotlinx-datetime v0.5.0.
I'm able to fix the issue by adding low config to gradle source set
val wasmJsMain by getting {
dependencies {
implementation(npm("@js-joda/timezone", "2.18.2"))
}
}
And adding below code to composeApp/src/wasmJsMain/kotlin/main.kt
@JsModule("@js-joda/timezone")
external object JsJodaTimeZoneModule
@lindenquan, that's different: kotlinx-datetime
explicitly doesn't depend on js-joda/timezone
, and you have to add the dependency yourself, but kotlinx-datetime
does depend on js-joda/core
, so it shouldn't be required to add a dependency explicitly.
I'm having this issue with 0.6.0 and Kotlin 2.0.10