-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@js-joda/core could not be found - jsMain logging in KMM project #7
Comments
Do you have a reproducer? I have no issue with the following configuration (KMP full stack project JVM + JS) kotlin {
jvm {
compilations.all {
kotlinOptions.jvmTarget = "1.8"
}
withJava()
testRuns["test"].executionTask.configure {
useJUnitPlatform()
}
}
js(IR) {
binaries.executable()
browser {
commonWebpackConfig {
cssSupport.enabled = true
}
}
}
sourceSets {
val commonMain by getting {
dependencies {
implementation("org.kodein.log:canard:0.16.0")
}
}
val commonTest by getting {
dependencies {
implementation(kotlin("test"))
}
}
val jvmMain by getting {
dependencies {
implementation("io.ktor:ktor-server-netty:2.0.2")
implementation("io.ktor:ktor-server-html-builder-jvm:2.0.2")
implementation("org.jetbrains.kotlinx:kotlinx-html-jvm:0.7.2")
}
}
val jvmTest by getting
val jsMain by getting {
dependencies {
implementation("org.jetbrains.kotlin-wrappers:kotlin-react:18.2.0-pre.346")
implementation("org.jetbrains.kotlin-wrappers:kotlin-react-dom:18.2.0-pre.346")
implementation("org.jetbrains.kotlin-wrappers:kotlin-emotion:11.9.3-pre.346")
}
}
val jsTest by getting
}
} In val commonLogger = LoggerFactory.default.newLogger(Logger.Tag("Canard", "Common")) in val jsLogger = LoggerFactory.default.newLogger(Logger.Tag("Canard", "JS"))
fun main() {
commonLogger.info { "Common Logger says hello in JS!" }
jsLogger.info { "KJS Logger says hello!" }
val container = document.createElement("div")
document.body!!.appendChild(container)
val welcome = Welcome.create {
name = "Kotlin/JS"
}
createRoot(container).render(welcome)
} |
Would it be possible to leave this issue open for now? |
I'm facing an issue when tried to do any logging in JS in a KMM project.
I'm using the latest 0.16 version of canard, see excerpt from the build.gradle.kts
See stack trace:
A possible workaround I found for the issue is to add the
@js-joda/core
as an npm dependency to thejsMain
sourceSet definition.Having this in the sourceSet closure, I am able to use canard in JS and I can see the logs with the default LoggingFactory in the console.
The text was updated successfully, but these errors were encountered: