Hi,
I try to use a npm package in a mpp project.
Like from the example:
dependencies {
// ...
implementation(npm("is-sorted", "1.0.5"))
}
@JsModule("is-sorted")
@JsNonModule
external fun <T> sorted(a: Array<T>): Boolean
console.log("Hello, Kotlin/JS!")
console.log(sorted(arrayOf(1,2,3)))
console.log(sorted(arrayOf(3,1,2)))
Now I wanna use another npm library with the name kafkjs in that way:
dependencies {
// ...
implementation (npm( "kafkajs", "^1.12.0"))
}
fun createConsumer(): dynamic {
return js(
“kafka.consumer({groupID: ‘test-group’ })”
)
}
but I alwas get the error:
ReferenceError: kafka is not defined
Any ideas what I am doing wrong?