On Kotlin React build systems

Dear Kotlin authors and hackers,

I have spent the last few days trying out the two main integrations of Kotlin and React (with build systems) that I could find on GitHub, namely Create React Kotlin App and the older Kotlin Fullstack Sample.

The former is based on Create React App, uses NPM as its main build tool, and is being actively worked on.

The latter was a fresh creation by @cy6erGn0m and @orangy, uses Gradle as its main build tool, but unfortunately seems to be abandoned for now.

I have found the NPM solution to be advantageous for speed and integration with the other Web technologies, but still problematic for Kotlin, for a number of reasons.

  1. Most Kotlin libraries are published on Maven, not on NPM (case in point, the excellent Korlibs), which makes them hard to install and use from NPM.

  2. Using NPM makes it hard / impossible to take advantage of Gradle Daemon, making Kotlin-JS compilations very slow (> 10 sec on React-Kotlin, as opposed to < 1 sec on plain React)

  3. Some useful features, especially for mixed JS/JVM codebases, such as Multi-platform projects, are only supported by Gradle.

Given this mismatch between NPM and Kotlin, is there any interest from the Kotlin team to keep working on the Gradle-based Kotlin Fullstack demo, which was promising?

Or is the current focus on adding incremental compilation and other features to the NPM-based demo?

In this case, how do you plan to integrate multi-platform Kotlin projects into NPM, especially if published on Maven only?

1 Like

I use the kotlin-frontend-plugin and it fits well my use case.

1 Like

Oh, I see. The kotlin-frontend-plugin is in fact being kept up to date and includes an example of functioning HMR (hot code reload)

Is there a demo based on the latest kotlin-frontend-plugin, but with React and HMR in place?