Re:TeaVM: Build Fast, Modern Web Apps in Java
by jillesvangurp on Sunday January 31, 2021 @05:39PM
(#25983331)
TeaVM is nice if you want to bring existing Java code depending on the Java standard library to a browser. Kotlin-js does not do that. You only have the Kotlin standard library if you target kotlin-js (well plus all the multiplatform stuff that is getting released lately). Multiplatform is the reason why this is getting interesting. There are a lot of good quality libraries that just work on kotlin-js now.
I've been using kotlin-js lately for browser development (with the Fritz2 framework). It's fine and improving rapidly. Just a year ago, this would have been a bit of a rough experience doing anything with it. But I've been using it since two months and have not really encountered any major issues. The Kotlin 1.4 release really improved things. And we indeed have a lot of Kotlin code for Android and our server so that made that an easy choice for us.
It's early days for WASM and languages like Kotlin and Java but I'm guessing that a lot of stuff is going to happen there in the next years. In the end you need more than a compilation target: you also need platform integration, development tools, and libraries. Kotlin-js is getting pretty nice for each of those and with all the multiplatform stuff coming out, you don't really need or miss a lot of the npm stuff. But if you do, it's fairly easy to deal with that as well (e.g. we integrated leaflet just a few weeks ago).
WASM support in Kotlin is still pretty immature. They recently kicked off an effort to improve support for that in the multiplatform gradle plugin. But there's still a lot of work to be done there. But, long term, I'd expect to compile to that rather than to Javascript.
I've been using kotlin-js lately for browser development (with the Fritz2 framework). It's fine and improving rapidly. Just a year ago, this would have been a bit of a rough experience doing anything with it. But I've been using it since two months and have not really encountered any major issues. The Kotlin 1.4 release really improved things. And we indeed have a lot of Kotlin code for Android and our server so that made that an easy choice for us.
It's early days for WASM and languages like Kotlin and Java but I'm guessing that a lot of stuff is going to happen there in the next years. In the end you need more than a compilation target: you also need platform integration, development tools, and libraries. Kotlin-js is getting pretty nice for each of those and with all the multiplatform stuff coming out, you don't really need or miss a lot of the npm stuff. But if you do, it's fairly easy to deal with that as well (e.g. we integrated leaflet just a few weeks ago).
WASM support in Kotlin is still pretty immature. They recently kicked off an effort to improve support for that in the multiplatform gradle plugin. But there's still a lot of work to be done there. But, long term, I'd expect to compile to that rather than to Javascript.