martmists
01/26/2023, 1:19 PMbashor
01/26/2023, 2:05 PM@JsExport
martmists
01/26/2023, 2:19 PMbashor
01/26/2023, 2:29 PMkotlin.js.JsExport
, it’s part of Kotlin/Wasm stdlib, NO other dependencies is needed.martmists
01/26/2023, 2:34 PMkotlinx.cinterop
typesbashor
01/26/2023, 3:01 PMmartmists
01/26/2023, 3:04 PMbashor
01/26/2023, 3:09 PMmartmists
01/26/2023, 3:20 PMSvyatoslav Kuzmich [JB]
01/26/2023, 3:59 PMI need to set my jsMain sourceset to depend on my wasmMain sourcesetThis is not supported. These targets are not compatible on Kotlin level. But they both can interact with JavaScript, and with quite a bit of effort it is possible to connect them this way. You would need to: • Annotate your K/Wasm top-level functions with @JsExport to expose them to JavaScript. At the moment only use numbers, strings and external types are supported as parameters. No byte arrays yet, unfortunately. • Declare corresponding external declarations with @JsModule on K/JS side. Note that K/Wasm currently exports functions as members on
default
object.
• Make sure that when you run or bundle you project, module identifier in @JsModule points to .mjs
file that K/Wasm generates. Alternatively, use other module resolution techniques like node_modules