Trying to figure out what I’m doing wrong. I created a small video of exactly what I’m doing in IntelliJ on Windows.
And I’ll describe it here in text.
- Create a new project
- Tick the Gradle > Kotlin/JS for browser template and untick everything else
- Add
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.8'
to the dependencies block in the build.gradle. - Sync the gradle files
- Attempt to use something from the
kotlinx.coroutines
namespace
Hopefully its just a silly thing I’m missing. I expected to just have to add the coroutines library to be able to actually import it. It looks like the library is listed in the project structure for the main module so I’m not sure what else might be wrong. Here is a repo of the project too.
plugins {
id 'org.jetbrains.kotlin.js' version '1.3.72'
}
group 'org.example'
version '1.0-SNAPSHOT'
repositories {
mavenCentral()
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-js"
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.8'
testImplementation "org.jetbrains.kotlin:kotlin-test-js"
}
kotlin.target.browser { }