Questions tagged [kotlin-js]
281 questions
2
votes
0 answers
How to use/create kotlin multiplatform JS library?
Created a Kotlin MPP for developing a JS library, and a JVM lib. Everything worked well in the Kotlin world and I was able to build the project. Once build was completed the distributions folder(inside build) had the projectName.js file and…

vizsatiz
- 1,933
- 1
- 17
- 36
2
votes
1 answer
Kotlin/Js add npm dependency from custom registry
I'm developing an application with Kotlin/JS and Gradle. I can easily add npm dependencies from the default npm registry with the implementation npm("query-string", "7.0.0") command.
However, I cannot add an npm dependency from a different npm…

Yannick
- 4,833
- 8
- 38
- 63
2
votes
0 answers
RxJs in full stack Kotlin/JS
I'm having difficulty importing the RxJs library in my full stack Kotlin/JS project. I put the following in my build.gradle.kts file in the frontendMain section:
implementation(npm("@reactivex/rxjs", "6.6.7", true))
But when I try to add a…

Michael220
- 193
- 12
2
votes
0 answers
Kotlin/JS NPE Source Reference
I have a Kotlin/JS project that is throwing a null pointer exception, but I can't figure out where it is coming from. The source map in the browser references exceptionUtils.kt?24ab which is a generic wrapper for the javascript…

RedBassett
- 3,469
- 3
- 32
- 56
2
votes
0 answers
What's the best pattern for exception handling when using coroutines in kotlinjs?
I have a kotlinjs app. I handle a particular event (dropping of data onto a component) like this:
onEvent {
drop = { event ->
GlobalScope.async {
//...
dropTask(y, data)
…

user717847
- 695
- 1
- 6
- 16
2
votes
0 answers
How to reference image resource in kotlin/JS
I try to reference an image resource from react kotlin app.
welcome.kt under src/main/kotlin:
import react.dom.img
@JsModule("./logo.svg")
@JsNonModule
external val logo: dynamic
@JsExport
class Welcome : RComponent() {
…

user15301099
- 21
- 1
2
votes
1 answer
How do I export a Kotlin JS project?
Sorry, but the Kotlin documentation doesn't help me to export a Kotlin JS project to deploy it on my webserver.
I created a new Kotlin Browser Application with the new project wizard in IntelliJ.
build.gradle.kts:
plugins {
kotlin("js") version…

Ralph Bergmann
- 3,015
- 4
- 30
- 61
2
votes
0 answers
Kotlin Js file size is too big
I currently have a problem with the file size of kotlin js. I have one multiplatform lib which has around 160Kb and integrate it in the kotlin js project. The kotlin js project itself does not have that much code.
After assembling (which should…

coffeLord
- 85
- 1
- 12
2
votes
1 answer
Dependency not available in Kotiln/JS
I am trying to use a library called KSVG in a Kotlin/JS project. The maintainer has tried to set up K/JS support, but it isn't working correctly. In IntelliJ, I am adding the following repo and dependency to my build.gradle.kts:
repositories {
…

RedBassett
- 3,469
- 3
- 32
- 56
2
votes
2 answers
Not able to post request using ktor client in kotlin js
Am trying to make an http post request but it is getting failed for reasons am not able to understand.
object KtorClient {
val client = HttpClient() {
install(JsonFeature) {
serializer = KotlinxSerializer()
}
}
}
suspend fun…

Tarun Chawla
- 508
- 4
- 17
2
votes
2 answers
Change Kotlin Javascript output directory
I have just started using Kotlin to produce Javascript, but cannot find a way to change the Javascript output directory.
This is specifically for a nodejs target, and using Gradle with Kotlin script.
There is an example given in the Kotlin docs for…

David Sowerby
- 21
- 2
2
votes
1 answer
What code coverage tool to use for the javascript code in a Kotlin Multiplatform project?
I can use jacoco on the JVM side, but what can I use on the JS side of the Multiplatform project?

dazza5000
- 7,075
- 9
- 44
- 89
2
votes
1 answer
Uncaught TypeError: this.resultContinuation_0 is undefined when trying to run a suspend function in Kotlin JS Browser onclick
I'm working on a multi-platform RISC-V simulator in Kotlin and I've been stuck on a problem for more than a week now. I've tried everything that I could find online but I had no luck with it.
To give you a little context:
I'm trying to bind this…

benny b
- 175
- 1
- 12
2
votes
3 answers
Waiting on fetch() in Kotlin JS?
I'm writing a WebGL app in Kotlin JS, and as such I need to fetch resource such as .obj files and shaders. I want to do this through HTTP requests, but I've run into issues.
I'm currently trying to do this via JS's fetch() API. The problem is that…

Forumpy
- 305
- 1
- 3
- 13
2
votes
0 answers
Using Kotlin multiplatform js file into war project
I have a multimodule gradle build with these two modules:
- Module A -> JVM/War build
- Module B -> Kotlin multiplatform with JVM and JS target
When I build Module B, I will get a js file. I want to include that js file into the webapp folder of…

Peter Fortuin
- 5,041
- 8
- 41
- 69