Skip to content
/ kwp Public

webpack loader for javascript artifacts produced by Kotlin.JS Gradle builds

License

Notifications You must be signed in to change notification settings

shafirov/kwp

Repository files navigation

kwp

webpack plugin for resolving modules produced by Kotlin.JS Gradle builds

This comes as Gradle plugin, which adds webpack_loader task to a project, which scans project jar artifacts for generated javascript files as well as Webpack plugin, which declares an alias for each Kotlin module to it resulting javascript output. Webpack plugin is also watching Kotlin sourcefiles and launches Webpack build appropriately.

For example of usage please look at https://github.com/shafirov/kwp-sample

Setting up: First, add repository and buildscript classpath dependency to be able to apply the plugin:

buildscript {
    repositories {
        maven {
            url "https://dl.bintray.com/shafirov/kwp"
        }
    }

    dependencies {
        classpath "org.jetbrains.kwp:kwp:0.1.8"
    }
}

Then for the project you have compileKotlin2Js apply the plugin:

    apply plugin: KWP

This is it for gradle part of setup. Now you need to hook up plugin (that comes with gradle distro) into webpack.config.js

var KotlinWebpackPlugin = require('./build/kwp/kwp')

var webpackConfig = {
  ...
    plugins: [
      new KotlinWebpackPlugin({
        buildFile: './build.gradle',
        project: 'showcase'
      })
    ]

Then you can just require some Kotlin modules:

require('showcase')

About

webpack loader for javascript artifacts produced by Kotlin.JS Gradle builds

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages