UNPKG

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