Hey, I’ve been in a cave for a while. I have a popular Kotlin script and I would like to make a web app around it, but I enjoy TypeScript/NextJS/etc.
Is it possible (and recommended) to compile my Kotlin library into JS and use together in a Turborepo project? I just need the “run” method, so it is kind of simple.
I could as well just invoke GPT-4 and ask to translate my code to TS, but I don’t want to erase Kotlin from my project that targets Kotlin.
r
Rob Murdock
08/01/2023, 9:48 PM
if its pure kotlin and doesn't require any java dependencies under-the-hood, then yeah! Kotlin JS will output a javascript file you can consume from JS in any form. Require it, and call your function. May have a little fusiness with how Kotlin packages look in JS, but nothing that you can't work around fairly easily.
b
Bernardo Ferrari
08/01/2023, 9:49 PM
Pure Kotlin
👍 1
Bernardo Ferrari
08/01/2023, 9:49 PM
Should I use gradle and etc in the build process to compile to a JS module?
Bernardo Ferrari
08/01/2023, 9:50 PM
When I built that I used kts which I'm not sure even still exists lol
r
Rob Murdock
08/01/2023, 9:50 PM
that's probably long-term the safest way to go with it.