You need to declare dependencies at kotlin source set, not global dependencies container:
plugins {
kotlin("js") version "1.3.40"
}
repositories {
jcenter()
}
kotlin {
target {
// You can drop browser or node if you targeting only one
nodejs()
browser()
}
sourceSets["main"].dependencies {
implementation(npm("react", "^16.8.1"))
}
}
If you plan to use multiplatform plugin, you need to use slightly different things:
Does anyone have module dependencies working for the multiplatform jsTest tasks? My project has multiple modules/projects (they are multiplatform modules). I’m trying to test the topmost module (the one that depends on the others), but the javascript is not even built.
Never mind. It seems that marking them browser and/or nodejs will do the deal.
For browser deployment, how does one collect these dependencies?
For non-npm dependencies I can get them via the compilation’s runtimeDependencyFiles property, but I can’t resolve that property once I’ve added an npm dependency
(Could not resolve all files for configuration ‘:new-project:jsRuntimeClasspath’.)