I'm trying to build some basic Kotlin code as a JS library. Just for testing, I want to be able to call some of this code right from a browser console.
Here is some of the code I'm working with.
build.gradle.kts
plugins {
kotlin("js") version "1.5.10"
}
group = "..."
version = "..."
repositories {
mavenCentral()
}
dependencies {
testImplementation(kotlin("test"))
}
kotlin {
js(LEGACY) {
browser {
webpackTask {
output.libraryTarget = "global"
output.library = "connect"
}
}
binaries.executable()
}
}
main.kt
package main
fun main(args: Array<String>) {
println("Hello world! From Kotlin!")
}
fun testLog(string: String){
console.log("test log")
console.log(string)
}
index.html
<!DOCTYPE html>
<html>
<head>
<script src="./connect.js"></script>
</head>
<body>
<h1>test</h1>
</body>
</html>
But this is what I get in the console.
What am I missing?
