@jetbrains/kotlin-webpack-plugin

3.0.2 • Public • Published

kotlin-webpack-plugin

This package allows compiling Kotlin files to JavaScript using webpack.

Installation

npm i @jetbrains/kotlin-webpack-plugin --save-dev

Requirements

This plugin requires a minimum of Node v8.6.0 and Webpack v4.0.0. To use this plugin with Webpack v3.0.0, you need to use v1.2.11 of this plugin.

Usage

Example of webpack configuration:

const KotlinWebpackPlugin = require('@jetbrains/kotlin-webpack-plugin');

module.exports = {
  entry: 'kotlinApp', // kotlinApp is the default module name

  resolve: {
    // "kotlin_build" is the build output directory
    modules: ['kotlin_build', 'node_modules']
  },

  // [OPTIONAL] To enable sourcemaps, source-map-loader should be configured
  module: {
    rules: [
      {
        test: /\.js$/,
        include: path.resolve(__dirname, '../kotlin_build'),
        exclude: [
          /kotlin\.js$/, // Kotlin runtime doesn't have sourcemaps at the moment
        ],
        use: ['source-map-loader'],
        enforce: 'pre'
      }
    ]
  },

  output: {
    path: __dirname + '/build',
    filename: 'build.js'
  },

  plugins: [
    new KotlinWebpackPlugin({
      src: __dirname + '/src'
    })
  ]
};

You can find a sample configuration in the example folder.

Readme

Keywords

Package Sidebar

Install

npm i @jetbrains/kotlin-webpack-plugin

Weekly Downloads

7

Version

3.0.2

License

Apache-2.0

Unpacked Size

13.6 kB

Total Files

6

Last publish

Collaborators

  • skoch13
  • jetbrains-admin
  • kotlin
  • jetbrains-buildserver
  • allvo
  • bashor