is it even sensible to have a configuration like t...
# webassembly
a
is it even sensible to have a configuration like this
Copy code
kotlin {
   wasmJs{
      nodeJs()
   }
}
r
Of course it is. You can run your K/Wasm application in nodeJS just like K/JS application. You just need to configure nodeJS canary to be able to run application or tests from gradle. https://github.com/rjaros/kilua/blob/main/kilua/build.gradle.kts#L76-L83
a
I see. Are there any benefits for choosing
Copy code
kotlin {
   wasmJs {         // this
      nodeJs()
   }

   wasmWasi {      // over this??
      nodeJs()
   }
}
r
wasi is completely different runtime and needs dedicated libraries. Currently there are almost none (e.g. no coroutines).
wasmJS on node uses JS runtime, you can use JS interop and most important libraries are available
a
I think koitlinx-serialization (version 1.6.2) already added a wasi target
So, mostly then, we we choose the former due to lack of third party libraries (at the moment)
r
You are right
It probably depends what you want to implement. WasmJS on node allows you to use the large part of JS ecosystem.
a
Thank you a lot
I still have a side question though. if wasi is a completely different runtime, then what does it mean to have it be declared like this
Copy code
wasmWasi {
      nodeJs()
   }
r
No idea 🙂
😀 1
a
As in, you run wasi (a completely different runtime) inside/from node(a completely different runtime)??
Seems so confusing at the moment
r
I would assume it's something connected with https://nodejs.org/api/wasi.html
a
Thanks for the link. Let me go through it
Well, you are probably right. And if that's the case, I find it so hard (and inconvenient) for the kotlin team to maintain different wasi runtimes through the KGP?? Coz we do have runtimes like (https://github.com/wasmerio/wasmer-java), and I believe there are many more But that should not make the kotlin team add it in the KGP like so, should it??
Copy code
wasmWasi {
  wasmerJava() // ??? possible, but why??
}
r
Why not? I would be happy to choose one or many supported runtimes with simple DSL.
a
I dunno, Coz there are going to be a gazillion of those?
r
There is already a gazillion of supported browsers inside the
useKarma { }
DSL and I find it really nice 🙂
a
hahahaha, very true. I find it really nice myself
s
Currently we already have a maintained Node.js support from Kotlin/JS KGP (we needed at least one to run tests without browsers). And now we reuse it for both wasmJs and wasmWasi 🙂 Hopefully, WASI as a standard, would allow you test your code in one runtime, and deploy it to the other.
a
Makes sense