# webpack-kotlin-loader

> Webpack loader that allows importing kotlin files in JS

Latest version **0.3.2** (published 2017-03-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install webpack-kotlin-loader
pnpm add webpack-kotlin-loader
yarn add webpack-kotlin-loader
bun add webpack-kotlin-loader
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.2 |
| Published | 2017-03-02 |
| First published | 2016-08-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=5.5 |
| Dependencies | 2 |
| Known vulnerabilities | 0 (+3 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 25 |
| Author | Andrey Skladchikov |
| Maintainers | huston007 |
| Keywords | webpack, kotlin, loader |

## Links

- npm: https://www.npmjs.com/package/webpack-kotlin-loader
- Repository: https://github.com/huston007/kotlin-loader
- Homepage: https://github.com/huston007/kotlin-loader#readme
- Issues: https://github.com/huston007/kotlin-loader/issues
- npm.io page: https://npm.io/package/webpack-kotlin-loader

## Dependencies (2)

- [loader-utils](https://npm.io/package/loader-utils.md) 1.0.2
- [source-map-resolve](https://npm.io/package/source-map-resolve.md) 0.5.0

## Alternatives

- [raw-loader](https://npm.io/package/raw-loader.md) — 4.3M weekly downloads
- [plop](https://npm.io/package/plop.md) — 1.4M weekly downloads
- [webpack-deadcode-plugin](https://npm.io/package/webpack-deadcode-plugin.md) — 80.3K weekly downloads
- [@storybook/preact-vite](https://npm.io/package/@storybook/preact-vite.md) — 54.2K weekly downloads
- [vite-plugin-transform](https://npm.io/package/vite-plugin-transform.md) — 2.4K weekly downloads

## Recent versions

- 0.3.2 (latest) — 2017-03-02
- 0.3.1 — 2017-03-01
- 0.3.0 — 2017-03-01
- 0.1.5 — 2016-08-15
- 0.1.4 — 2016-08-13
- 0.1.3 — 2016-08-13
- 0.1.2 — 2016-08-13
- 0.1.1 — 2016-08-13
- 0.1.0 — 2016-08-12

## README

# kotlin-loader

### Kotlin webpack loader that allows importing Kotlin package into your JS

#### Please note that this loader is not production ready, it's still under development.

It uses kotlinc-js compiler to convert Kotlin code to JavaScript. Note that Kotlin codebase is not file-based, but package-based. So it's impossible to compile file-to-file at the moment, so you should import your kotlin entry point once.

See [build example](https://github.com/huston007/kotlin-loader/tree/master/examples/simple), [app example](https://github.com/huston007/kotlin-loader-example).

Usage:

```sh
npm i webpack-kotlin-loader --save-dev
```

Do not forget to install kotlin runtime:
```sh
npm i kotlin --save
```

Usage (for webpack 2):
`webpack.config.js`
```js
var path = require('path');
var webpack = require('webpack');

module.exports = {
  context: __dirname,
  devtool: 'source-map',
  entry: {
    main: './entry'
  },
  output: {
    path: __dirname + '/dist',
    filename: 'build.js'
  },
  module: {
    rules: [
      {
        test: /\.kt$/,
        use: [
          {
            loader: 'webpack-kotlin-loader',
            options: {
              srcRoot: path.resolve(__dirname, './')
            }
          }
        ]
      }
    ]
  }
};

```
Where `srcRoot` should be set to root directory which contains your kotlin sources.

Then you could import your kotlin entry point somewhere:
```js
require('./app/app.kt');
```

---
_Source: https://npm.io/package/webpack-kotlin-loader · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
