Skip to content
Advertisement

Koltin multiplatform Javascript IR build creates empty module

I have added the JS target for our Kotlin Multi platform project. The project is named STT.

JavaScript

When I look at the build folder or when I run the JS task jsRun the JS lib looks empty.

Here is for example the stt.js from the build folder

JavaScript

That essentially is an empty object

However, when I use the BOTH or Legacy that file looks ok

JavaScript

What am I missing ?

Advertisement

Answer

The IR backend doesn’t export any code to js by default. You need to add @JsExport to the declarations you want accessible. See https://kotlinlang.org/docs/js-to-kotlin-interop.html#jsexport-annotation

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement