Complete n00b question: I was hoping to use Kotlin...
# javascript
d
Complete n00b question: I was hoping to use Kotlin in addition to my existing backend JavaScript code using Node. So I setup a new project and selected NodeJS Application and it created the Hello World app, which I can run with
/gradlew run
. But I want to be able to take the JavaScript output and use it in my existing app. Where is the JS? I see there's a /build/js folder but no .js files, even after doing a
./gradlew build
. :: confused ::
b
You also need to setup binaries to get actual js outputs
d
@Grégory Lureau "The term 'jsBrowserDistribution' is not recognized as the name of a cmdlet, function, script file, or operable program."
@Big Chungus how exactly does one "setup binaries"?
b
kotlin.js.binaries.executable()
t
jsBRowserDistribution
and so are gradle tasks names. You can run them with
./gradlew <task-name>
command or from the ide. Think of
npm build
. To set up binaries, you have to add the
binaries.executable()
your gradle build.
d
Thanks - I see that
binaries.exectuable()
was already in the build.gradle file as part of the new project setup. However when I try
./gradlew jsBrowserDistribution jsPublicPackageJson
I get "Task 'jsBrowserDistribution' not found in root project"
Apparently I had to add a
browser{ }
block to the kotlin block and then use
./gradlew browserDistribution publicPackageJson
. How did you all figure this stuff out? I'm really have a hard time finding documentation. 😞
t
Mostly by checking other existing projects. Also, there are a few existing templates you might want to keep in mind, so you can go back and check them. I've have one for my lib, you can see examples in there for most common problems: https://github.com/spxbhuhb/zakadabar-application-template
d
Oh this is great. Thank you! 🎉