Hello there,
I have a Kotlin jvm+wasm project. Now I'm diving a little more in the wasm side, and this little thing doesn't work. The function doesn't get exported:
@OptIn(ExperimentalJsExport::class)
@JsExport
fun addOne(x: Int): Int = x + 1
Every other aspect of JS Interop work like
Kotlin functions with JavaScript code like this one work:
fun setLocalSettings(value: String): Unit = js(
"""{
localStorage.setItem('settings', value);
}"""
In the doc (
https://kotlinlang.org/docs/wasm-js-interop.html#kotlin-functions-with-javascript-code) it's written:
> Kotlin/Wasm functions marked with the
@JsExport
annotation are visible as properties on a
default
export of the generated
.mjs
module. You can then use this function in JavaScript:
>
// JavaScript
>
> import exports from "./module.mjs"
>
> exports.addOne(10)
But I don't see this file, well I'm confuse ๐