UNPKG

2.09 kBMarkdownView Raw
1# Neutrino Hot Middleware
2[![NPM version][npm-image]][npm-url] [![NPM downloads][npm-downloads]][npm-url] [![Join Slack][slack-image]][slack-url]
3
4`neutrino-middleware-hot` is Neutrino middleware for enabled Hot Module Replacement with Webpack's
5`HotModuleReplacementPlugin`. This middleware is usually only added during development.
6
7## Requirements
8
9- Node.js v6.10+
10- Yarn or npm client
11- Neutrino v7
12
13## Installation
14
15`neutrino-middleware-hot` can be installed via the Yarn or npm clients.
16
17#### Yarn
18
19```bash
20❯ yarn add neutrino-middleware-hot
21```
22
23#### npm
24
25```bash
26❯ npm install --save neutrino-middleware-hot
27```
28
29## Usage
30
31`neutrino-middleware-hot` can be consumed from the Neutrino API, middleware, or presets. Require this package
32and plug it into Neutrino:
33
34```js
35// Using function middleware format
36const hot = require('neutrino-middleware-hot');
37
38neutrino.use(hot);
39```
40
41```js
42// Using object or array middleware format
43module.exports = {
44 use: ['neutrino-middleware-hot']
45};
46```
47
48## Customization
49
50`neutrino-middleware-hot` creates some conventions to make overriding the configuration easier once you are ready to
51make changes.
52
53### Plugins
54
55The following is a list of plugins and their identifiers which can be overridden:
56
57| Name | Description | Environments and Commands |
58| --- | --- | --- |
59| `hot` | Enables Hot Module Replacement. | all |
60| `named-modules` | Enables named modules for improved debugging and console output. | all |
61
62## Contributing
63
64This middleware is part of the [neutrino-dev](https://github.com/mozilla-neutrino/neutrino-dev) repository, a monorepo
65containing all resources for developing Neutrino and its core presets and middleware. Follow the
66[contributing guide](https://neutrino.js.org/contributing) for details.
67
68[npm-image]: https://img.shields.io/npm/v/neutrino-middleware-hot.svg
69[npm-downloads]: https://img.shields.io/npm/dt/neutrino-middleware-hot.svg
70[npm-url]: https://npmjs.org/package/neutrino-middleware-hot
71[slack-image]: https://neutrino-slack.herokuapp.com/badge.svg
72[slack-url]: https://neutrino-slack.herokuapp.com/