is there a way to replace webpack with something f...
# javascript
b
is there a way to replace webpack with something faster like esbuild? I'm not looking for a fully featured solution like Vite which has additional requirements like an index.html, I'm purely looking for a faster bundler
1
b
You can run esbuild manually on the generated JavaScript file. Or, if you want to run esbuild as part of your Gradle build, you can create a Gradle task that would run esbuild on the output of the Kotlin/JS compilation task.
b
right, looking at build/js it seems that the kotlin compile task writes it's output into that folder
I'm unsure however if esbuild works on that file structure
t
Vite is here!
b
thanks!
I suppose you absolutely need an index.html file
🚫 1
I've just got a main file, nothing that really needs HTML
nvm, there's a config option for an entrypoint https://vite.dev/guide/backend-integration.html
t
> I suppose you absolutely need an index.html file Default configuration entry point - JS file 😉
b
perfect
t
If you will need something more - you can copy and modify default KFC config
b
do you have an example config lying around?
or is it just: enable the plugin, place a vite.config.mjs and you're done?
t
It will work even without
vite.config.mjs
😉
b
what about tests?
works out of the box with kotlin test?
t
They work fine on Webpack + Karma 🧌
f
Love me some kfc
🙂 1
f
@turansky I am trying to test your plugin, vite starts but I get an error 404 Could you have a look at my gradle files? My files (copied from examples/vite-dev) are placed in js/src/main my build.gradle.kts
Copy code
// build.gradle.kts
plugins {
    id("org.jetbrains.kotlin.multiplatform") version "2.1.20" // Oder eine neuere Version
    id("io.github.turansky.kfc.application") version "13.15.0" // Oder eine neuere Version
    id("org.jetbrains.kotlin.plugin.js-plain-objects") version "2.2.0-RC3"
}

version = "1.0-SNAPSHOT"

kotlin {
    js(IR) {
        browser()
        binaries.executable()
    }

    sourceSets {
        val jsMain by getting {
            dependencies {
                implementation(kotlinWrappers.browser)
            }
        }
    }
}
settings.gradle
Copy code
// settings.gradle.kts
pluginManagement {
    repositories {
        gradlePluginPortal()
        mavenCentral()
    }
}
dependencyResolutionManagement {
    repositories {
        mavenCentral()
    }

    versionCatalogs {
        create("kotlinWrappers") {
            val wrappersVersion = "2025.6.5"
            from("org.jetbrains.kotlin-wrappers:kotlin-wrappers-catalog:$wrappersVersion")
        }
    }
}

rootProject.name = "test-vite"

include("js")
t
Is it available on GitHub?
Source folder in subproject should be default -
src/jsMain/kotlin
f
Nope, I’ll try to add a test-project on github
👍 1