How to set up Kotlin for NodeJS with TS dependencies?

How to set up Kotlin for NodeJS with TS dependencies?

Hey, I’ve been using Kotlin in the JVM for a few years and I decided to try it on nodejs (I’m also working with node for a few years, so I’m not newbie in the platform).

I went to IDEA > New Project > Gradle > Kotlin (NodeJS). Added a few dependencies and enable the experimental Dukat:


dependencies {implementation(kotlin("stdlib-js"))implementation(npm("firebase", "7.20.0"))implementation(npm("left-pad", "1.3.0"))}

Both firebase and left-pad (obviously I’m using this for test) does have typescript mappings, so the kotlin mappings should be generated, right?

I refreshed Gradle and went to the src/main trying to import the dependencies, but nothing happened and I don’t know why. Looking at build/js/node_modules the dependencies are there.

I tried to run the Dukat gradle tasks and nothing happened too.

This section about external dependencies is very bad documented, I need some help to set it up.

btw I’m on Kotlin 1.4, my full build.gradle looks like this:

plugins {id("org.jetbrains.kotlin.js") version "1.4.10"}group = "dev.nathanpb"version = "1.0.0"repositories {mavenCentral()}dependencies {implementation(kotlin("stdlib-js"))implementation(npm("firebase", "7.20.0"))implementation(npm("left-pad", "1.3.0"))}kotlin {js {nodejs {}binaries.executable()}}

Thank you all, hope I will be using this in production soon

SOLUTION: I’m stupid and can’t read documentations:

submitted by /u/_nathata
[link] [comments]