Debugging
You can easily debug Kilua applications in most modern browsers (e.g. Chrome or Firefox), which support source maps generated by Kotlin/JS compiler. Source maps allow you to see Kotlin source code in the browser "Sources" panel. You can see line numbers, step through your code, set breakpoints and watch variable values just like with plain JavaScript.
WasmJs debugging is currently not supported.
You can also debug Kilua application directly in IntelliJ IDEA Ultimate by creating new "JavaScript Debug" configuration pointing to http://localhost:3000 url.
Note: Source maps are disabled by default in all Kilua template projects, because the development cycle (hot reload) is a lot faster without them. To enable source maps you need to remove line sourceMaps = false
from your build.gradle.kts
file and remove line config.devtool = 'eval-cheap-source-map'
from webpack.config.d/webpack.js
file.
Console.log
Some UI interactions may be tricky to handle with a debugger, and so being able to fall back to console logging is useful. When developing in common code, you can't import and access native kotlin.js.console
object. You can use dev.kilua.externals.console
object instead.
Last updated