Hi - another gradle doesn't seem to be picking up ...
# javascript
p
Hi - another gradle doesn't seem to be picking up npm dependencies thread I'm afraid ! Any help greatly appreciated. Basically classes like the react ones aren't being picked up and my Kotlin doesnt compile. Example bit of code that doesn't compile:
Copy code
import react.*
and my gradle build file (this time in Kotlin):
Copy code
plugins {
    id("org.jetbrains.kotlin.js") version "1.3.61"
}

repositories {
    mavenCentral()
    jcenter()
}

kotlin {
    sourceSets.forEach { sourceSet ->

        // double check source sets are OK

        sourceSet.kotlin.sourceDirectories.files.forEach {
            println(it.absoluteFile)
        }
    }
    sourceSets["main"].dependencies {
        implementation(npm("react", "16.8.3"))
        implementation(npm("@jetbrains/kotlin-css", "1.0.0-pre.89"))
        implementation(npm("@jetbrains/kotlin-css-js", "1.0.0-pre.89"))
        implementation(npm("@jetbrains/kotlin-styled", "1.0.0-pre.89"))
        implementation(npm("react-google-charts"))

    }
    target {

        browser {

        }
    }
}

dependencies {
    implementation(kotlin("stdlib-js"))
    implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core-js:1.3.2")
}

contents of generated file .......build/js/packages/myprojectname/package.json

{
  "main": "kotlin/myprojectfile.js",
  "devDependencies": {
    "webpack": "4.41.2",
    "webpack-cli": "3.3.9",
    "webpack-dev-server": "3.8.2"
  },
  "dependencies": {
    "kotlin": "1.3.61",
    "kotlinx-coroutines-core": "1.3.2",
    "kotlin-source-map-loader": "1.3.61",
    "react": "16.8.3",
    "@jetbrains/kotlin-css": "1.0.0-pre.89",
    "@jetbrains/kotlin-css-js": "1.0.0-pre.89",
    "@jetbrains/kotlin-styled": "1.0.0-pre.89",
    "react-google-charts": "*"
  },
  "peerDependencies": {},
  "optionalDependencies": {},
  "bundledDependencies": [],
  "name": "myprojectfile",
  "version": "0.0.0-unspecified"
}
p
you also need to include the the react type definitions from here https://bintray.com/kotlin/kotlin-js-wrappers/kotlin-react
👍 1
p
ah, great thanks, will try that later today