Open Zomis opened 3 weeks ago
A workaround for this problem:
Change in build.gradle.kts
val modules = mutableMapOf<String, String>()
modules["main"] = main.readText()
to
val modules = mutableMapOf<String, String>()
val fixGlobalThis = "if (!Game.rooms['sim']) globalThis = this;"
modules["main"] = fixGlobalThis + main.readText()
In the persistent world I got this in the console:
While in simulation I got this in the console:
This makes the compiled JavaScript not work in the persistent world, only in the simulation.
So if I try to use my Kotlin code compiled to JavaScript in the persistent world, I get this:
If I turn off minification, I can see where exactly the error is: