@jetbrains/kotlin-webpack-plugin
v3.0.2
Published
Kotlin plugin for webpack
Downloads
122
Readme
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.