I recently started to have a look at Kotlin and managed to create my first JVM applications. It\'s so cool to have a single language that compiles both to Java and JS. So, now I
Using the pom below:
4.0.0
com.example.kotlin
kotlin-js
1.0-SNAPSHOT
pom
1.3.61
UTF-8
1.3
1.3
org.jetbrains.kotlin
kotlin-stdlib-js
${kotlin.version}
kotlin-maven-plugin
org.jetbrains.kotlin
${kotlin.version}
compile
compile
js
${project.basedir}/src/main/kotlin
umd
Inside src/main/kotlin
you can add Hello.kt
containing a fun main(args : Array
then the following would print hello
mvn clean package
cd target
npm i kotlin
node js/kotlin-js.js
or you can add a non-main method and then use require()
from other js code or add it to the browser using (together with
kotlin
runtime).