plugins { id("org.jetbrains.kotlin.js") version "1.5.20-RC" } group = "fr.username404" version = "0.1" repositories { mavenCentral() } dependencies { implementation(kotlin("stdlib-js")) implementation("org.jetbrains.kotlinx:kotlinx-html:${rootProject.property("kotlinx-html_version")}") implementation("io.ktor:ktor-client-core:${rootProject.property("ktor_version")}") } val outputDirectory = file("$rootDir/compiledOutput") kotlin { js(IR) { moduleName = "Username404_Website" compilations.all { with(languageSettings) { apiVersion = coreLibrariesVersion.substring(0..2) languageVersion = (apiVersion!!.toDouble() + 0.1).toString() progressiveMode = true } with(kotlinOptions) { moduleKind = "plain" freeCompilerArgs = freeCompilerArgs + listOf( "-Xopt-in=kotlin.RequiresOptIn", "-Xopt-in=kotlin.js.ExperimentalJsExport", "-Xir-property-lazy-initialization" ) } } browser { webpackTask { destinationDirectory = outputDirectory output.library = "Web404" output.libraryTarget = "this" cssSupport.enabled = true } runTask { cssSupport.enabled = true } testTask { useKarma { useFirefoxNightlyHeadless() webpackConfig.cssSupport.enabled = true } } } binaries.executable() } } tasks { clean.get().delete.add(outputDirectory) withType(ProcessResources::class) { destinationDir = outputDirectory } }