question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

unable to build with js target

See original GitHub issue
// (...) DependencyInjection.kt
import org.kodein.di.DI
import org.kodein.di.bind
import org.kodein.di.instance
import org.kodein.di.singleton

val DependencyInjection = DI {
    bind<RepositoryList>() with singleton { RepositoryListImpl(instance()) }
}
> Task :compileKotlinJs FAILED
e: /(...)/di/DependencyInjection.kt: (5, 8): Unresolved reference: org
e: /(...)/di/DependencyInjection.kt: (6, 8): Unresolved reference: org
e: /(...)/di/DependencyInjection.kt: (7, 8): Unresolved reference: org
e: /(...)/di/DependencyInjection.kt: (8, 8): Unresolved reference: org
e: /(...)/di/DependencyInjection.kt: (10, 27): Unresolved reference: DI
e: /(...)/di/DependencyInjection.kt: (11, 5): Unresolved reference: bind
e: /(...)/di/DependencyInjection.kt: (11, 33): Unresolved reference: singleton
e: /(...)/di/DependencyInjection.kt: (11, 64): Unresolved reference: instance
// (...) build.gradle.kts
kotlin {
    android {
        publishLibraryVariants("release", "debug")
        compilations.all {
            kotlinOptions {
                jvmTarget = JavaVersion.VERSION_1_8.toString()
            }
        }
    }

    jvm {
        compilations.all {
            kotlinOptions {
                jvmTarget = JavaVersion.VERSION_1_8.toString()
                freeCompilerArgs.plus("-Xopt-in=kotlin.ExperimentalMultiplatform")
                freeCompilerArgs.plus("-Xuse-experimental=kotlin.Experimental")
                freeCompilerArgs.plus("-Xlint:-options")
            }
        }

    }
    js(IR) {
        browser {
            binaries.executable()
            testTask {
                useKarma {
                    useChromeHeadless()
                    webpackConfig.cssSupport.enabled = true
                }
            }
        }
    }

    sourceSets {
        val serializationVersion = "0.20.0-${kotlinVersion}"
        val ktorVersion = "1.3.2-${kotlinVersion}"
        val coroutineVersion = "1.3.8"
        val androidKtxVersion = "1.2.0"
        val kodeinDiVersion = "7.0.0"

        all {
            dependencies {
            }
        }

        val commonMain by getting {
            dependencies {
                implementation("org.kodein.di:kodein-di:$kodeinDiVersion")
                implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core-common:$coroutineVersion")
                implementation("io.ktor:ktor-client-core:$ktorVersion")
                implementation("io.ktor:ktor-client-serialization:$ktorVersion")
            }
        }

        val jvmMain by getting {
            dependencies {
                implementation("io.ktor:ktor-client-apache:$ktorVersion")
                implementation("io.ktor:ktor-client-serialization-jvm:$ktorVersion")
                implementation("org.springframework.boot:spring-boot-starter-data-rest")
                implementation("org.hibernate:hibernate-envers:5.4.12.Final")
            }
        }

        val jsMain by getting {
            dependencies {
                implementation("org.kodein.di:kodein-di-js:$kodeinDiVersion")
                implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core-js:$coroutineVersion-$kotlinVersion")
                implementation("io.ktor:ktor-client-js:$ktorVersion")
                implementation("io.ktor:ktor-client-serialization-js:$ktorVersion")
            }
        }
        // (...)

Removing js target in gradle.build.kts makes the build successful. Also, without the kodein-DI dependency but by keeping the js target, the build is successful, so it seems related to the kodein artifacts. Am I missing something ?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
romainbslcommented, Aug 19, 2020

Nope IR is not available yet for DI, will work on this ASAP

0reactions
romainbslcommented, Oct 22, 2020

Seems to be fixed. Waiting for Kotlin 1.4.30.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Make target js.build fails: Can't resolve 'ttn-lw' #157 - GitHub
The issue is in the order of the javascript build process. Currently, the v3 console uses the javascript sdk that is under development...
Read more >
Unable to get the event target property of a named function
Firstly, the each() is redundant code as you can access the index of the clicked element using $(this).index() . Then you simply need...
Read more >
Build fails to remove previous target - Visual Studio Feedback
It seems that your executable (ssowarmerservice.exe) is running when you try to build.
Read more >
Configure projects to target platforms - Visual Studio (Windows)
To configure a project to target Arm64 and other platforms. On the menu bar, choose Build > Configuration Manager. In the Active solution ......
Read more >
API - esbuild
This will generate two output files, out/out1.js and out/out2.js corresponding to the two entry points home.ts and settings.ts . #External. Supported by: Build....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found