Hello, I’ve been using Kotlin to develop a small 2D simulation software, and I’m using Kotlin multiplatform projects to make it run on both the JVM and in a browser. So far it works well.
To make my application work in the browser, I’m including the big JS file which is under the “build/distributions” folder after running the “build” Gradle task. When my Kotlin/JS application contains a main() function, this one is automatically being called when the HTML page is opened and it works well.
But if I remove the main function and instead I create a start() function which is supposed to be called manually (after a click on a button), it does not work: it says the function start() is not defined even though it is declared in the Kotlin code.
After opening the generated JS file it seems that indeed there is no start() function. It looks like all the name of the functions have been minified.
I tried adding @JsName, but it didn’t change anything.
So I guess I’m doing something wrong, but I really don’t know what and how to make it work.