https://kotlinlang.org logo
#javascript
Title
# javascript
b

Bernhard

03/15/2024, 1:34 PM
I'm following https://kotlinlang.org/docs/js-project-setup.html but see no compiled js file, are the docs outdated and how can I create a minimally working setup?
1
this is my build.gradle.kts
Copy code
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin

plugins {
    kotlin("multiplatform") version "1.9.23"
}

group = "at.posselt"
version = "0.0.1"

repositories {
    mavenCentral()
}

kotlin {
    js {
        browser {
            webpackTask {
                mainOutputFileName = "kjs.js"
                output.libraryTarget = "plain"
            }
        }
        binaries.executable()
    }
    sourceSets {
        commonTest.dependencies {
            implementation(kotlin("test"))
        }
    }
}

rootProject.plugins.withType<NodeJsRootPlugin> {
    rootProject.the<NodeJsRootExtension>().download = false
}

dependencies {
}
a

Artem Kobzar

03/15/2024, 1:57 PM
What gradle task do you run?
b

Bernhard

03/15/2024, 1:57 PM
jsRun
a

Artem Kobzar

03/15/2024, 1:59 PM
with
jsRun
the webpack devserver run (so, no bundle will be generated). Try to run
jsBrowserDevelopmentWebpack
or
jsBrowserProductionWebpack
b

Bernhard

03/15/2024, 1:59 PM
thanks, I also figured out that the directory names were wrong, got it working now, thanks!