Anthony Naddeo
Anthony Naddeo

Reputation: 2751

Can't add kotlinx to a fresh Kotlin/JS project

Trying to figure out what I'm doing wrong. I created a small video of exactly what I'm doing in IntelliJ on Windows.

https://www.youtube.com/watch?v=nIH_55Zbxus&feature=youtu.be

And I'll describe it here in text.

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 { }

Upvotes: 1

Views: 1364

Answers (1)

vanyochek
vanyochek

Reputation: 905

You should add kotlinx-coroutines-core-js dependency. See the documentation: https://github.com/Kotlin/kotlinx.coroutines#js

Upvotes: 1

Related Questions