Skip to content

turansky/kfc-plugins

Repository files navigation

CI Status CI Status Gradle Plugin Portal Kotlin JavaScript target WASM target

Kotlin/JS Fast Configuration

latest-tools

Usage

build.gradle.kts

plugins {
    id("io.github.turansky.kfc.latest-tools") version "19.0.0"
}

Use case

  • Latest security updates
  • Latest features

Applied configuration

  • Node, NPM - latest LTS
    • NPM - package manager (instead of Yarn)
    • .kotlin-locks/ - directory for package-lock.json files
  • Webpack (+cli, +dev-server) - latest
  • Mocha - latest

application

Usage

build.gradle.kts

plugins {
    id("io.github.turansky.kfc.application") version "19.0.0"
}

Use case

  • You need fast bundler - like Vite ;)

Platfoms

# gradle.properties

# default
kfc.platform=js

# WasmJS
kfc.platform=wasmjs

# Both (JS and WasmJS)
kfc.platform=web

Defaults

  • Kotlin/JS
    • Target es2015
    • Granularity
      • per-file
        • Default
        • Required for lazy modules, workers, worklets support
      • whole-program
        • Set kfc.per.file=false to activate
        • Recommended for isolated single file applications
  • Kotlin/WasmJS
    • Target es2015

Configuration

You can add your custom vite.config.mjs (example) and other configuration files in vite folder:

my-app/
  src/jsMain/kotlin/
  vite/
    vite.config.mjs   // custom Vite config
    myscript.js       // also will be copied
    .env              // main `.env` file 
    .env.development
    .env.production    

Dev Server

  1. Add index.html file with module script to JS entrypoint (example)

  2. Specify custom config file with root to kotlin (example)

  3. Start a dev server, run jsViteDev task (example)

Source Maps

Enable source maps generation:

kfc.source.maps=true

About

Kotlin/JS Fast Configuration

Topics

Resources

License

Stars

Watchers

Forks

Contributors