# elm-hot-loader

> [![NPM](https://nodei.co/npm/elm-hot-loader.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/elm-hot-loader/)

Latest version **0.5.4** (published 2016-12-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install elm-hot-loader
pnpm add elm-hot-loader
yarn add elm-hot-loader
bun add elm-hot-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.5.4 |
| Published | 2016-12-21 |
| First published | 2016-02-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 146 |
| Author | fluxxu |
| Maintainers | ventmere |

## Links

- npm: https://www.npmjs.com/package/elm-hot-loader
- Repository: https://github.com/fluxxu/elm-hot-loader
- Homepage: https://github.com/fluxxu/elm-hot-loader#readme
- Issues: https://github.com/fluxxu/elm-hot-loader/issues
- npm.io page: https://npm.io/package/elm-hot-loader

## Dependencies (1)

- [loader-utils](https://npm.io/package/loader-utils.md) ^0.2.12

## Recent versions

- 0.5.4 (latest) — 2016-12-21
- 0.5.3 — 2016-11-24
- 0.5.2 — 2016-11-21
- 0.5.1 — 2016-11-21
- 0.5.0 — 2016-11-21
- 0.4.2 — 2016-11-15
- 0.4.1 — 2016-11-10
- 0.3.7 — 2016-11-10
- 0.4.0 — 2016-11-10
- 0.3.5 — 2016-11-07
- 0.3.4 — 2016-08-26
- 0.3.3 — 2016-05-27
- 0.3.2 — 2016-05-20
- 0.3.1 — 2016-05-18
- 0.3.0 — 2016-05-18
- … 8 more at https://npm.io/package/elm-hot-loader/versions

## README

# Elm Hot Loader [![Version](https://img.shields.io/npm/v/elm-hot-loader.svg)](https://www.npmjs.com/package/elm-hot-loader)
[![NPM](https://nodei.co/npm/elm-hot-loader.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/elm-hot-loader/)

Hot swapping for [Elm](http://elm-lang.org/) module.

This loader injects [HMR](https://webpack.github.io/docs/hot-module-replacement.html) support code to the Elm module generated by [elm-webpack-loader](https://github.com/rtfeldman/elm-webpack-loader). 

## Change Log

### 0.5.0
* Elm 0.18 support

### 0.4.0
* Add event callback
see https://github.com/fluxxu/elm-hot-loader/issues/18

### 0.3.3
* Better elm-lang/websocket support (thanks to @rundis)

### 0.3.1
* Don't error when there are no ports (thanks to @glenjamin)

### 0.3.0
* Elm 0.17 support
* swap port and EmptyAction are gone. Enable this loader and it just works.
* Incoming ports still work after hot swapping

## Installation

```sh
$ npm install --save elm-webpack-loader elm-hot-loader
```


## Usage

[Documentation: Using loaders](http://webpack.github.io/docs/using-loaders.html)

In your `webpack.config.js` file:

```js
module.exports = {
  module: {
    loaders: [{
      test: /\.elm$/,
      exclude: [/elm-stuff/, /node_modules/],
      loader: 'elm-hot!elm-webpack'
    }]
  }
};
```

If you don't use elm-webpack-loader to compile Elm, just make sure webpack uses elm-hot to load your compiled js file.
Add this to your webpack config file:
```
loaders: [
  // ...
  {
      test: /[YOUR_COMPILED_JS_FILE_NAME_HERE]\.js$/,
      loader: 'elm-hot'
  }
  // ...
]
```

You should also add the `--hot` flag when starting webpack.

### Dependency

This loader relies on elm-webpack-loader to compile Elm to JS.

### Example

You can find an example project at
[elm-hot-loader-starter](https://github.com/fluxxu/elm-hot-loader-starter).

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