# neutrino-middleware-dev-server

> Neutrino middleware for starting a webpack-dev-server

Latest version **7.4.0** (published 2017-12-04) · MPL-2.0 license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install neutrino-middleware-dev-server
pnpm add neutrino-middleware-dev-server
yarn add neutrino-middleware-dev-server
bun add neutrino-middleware-dev-server
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 7.4.0 |
| Published | 2017-12-04 |
| First published | 2017-06-15 |
| Weekly downloads | 0 |
| License | MPL-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 (+7 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 3905 |
| Author | Constantine Genchevsky |
| Maintainers | eliperelman |
| Keywords | neutrino, neutrino-middleware, webpack, dev, server, hmr, hot module replacement |

## Links

- npm: https://www.npmjs.com/package/neutrino-middleware-dev-server
- Repository: https://github.com/mozilla-neutrino/neutrino-dev/tree/master/packages/neutrino-middleware-dev-server
- Homepage: https://neutrino.js.org
- Issues: https://github.com/mozilla-neutrino/neutrino-dev/issues
- npm.io page: https://npm.io/package/neutrino-middleware-dev-server

## Dependencies (4)

- [opn](https://npm.io/package/opn.md) ^5.1.0
- [webpack](https://npm.io/package/webpack.md) ^3.6.0
- [deepmerge](https://npm.io/package/deepmerge.md) ^1.5.2
- [webpack-dev-server](https://npm.io/package/webpack-dev-server.md) ^2.9.1

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 7.4.0 (latest) — 2017-12-04
- 7.3.3 — 2017-11-21
- 7.3.2 — 2017-11-13
- 7.3.1 — 2017-11-06
- 7.3.0 — 2017-10-31
- 7.2.3 — 2017-10-26
- 7.2.1 — 2017-10-21
- 7.1.10 — 2017-10-18
- 7.1.3 — 2017-10-17
- 7.1.2 — 2017-10-13
- 7.1.1 — 2017-10-10
- 7.1.0 — 2017-10-06
- 7.0.2 — 2017-10-03
- 7.0.1 — 2017-09-28
- 7.0.0 — 2017-09-28
- … 14 more at https://npm.io/package/neutrino-middleware-dev-server/versions

## README

# Neutrino Dev Server Middleware

`neutrino-middleware-dev-server` is Neutrino middleware for starting a Webpack Dev Server for fast development cycles.

[![NPM version][npm-image]][npm-url]
[![NPM downloads][npm-downloads]][npm-url]
[![Join the Neutrino community on Spectrum][spectrum-image]][spectrum-url]

## Requirements

- Node.js v6.10+
- Yarn or npm client
- Neutrino v7

## Installation

`neutrino-middleware-dev-server` can be installed via the Yarn or npm clients.

#### Yarn

```bash
❯ yarn add neutrino-middleware-dev-server
```

#### npm

```bash
❯ npm install --save neutrino-middleware-dev-server
```

## Usage

`neutrino-middleware-dev-server` can be consumed from the Neutrino API, middleware, or presets. Require this package
and plug it into Neutrino:

```js
// Using function middleware format
const devServer = require('neutrino-middleware-dev-server');

// Usage with default options
neutrino.use(devServer);

// Usage with custom options (default options are shown)
neutrino.use(devServer, { 
  https: false,
  port: 5000,
  host: 'localhost',
  public: 'localhost',
  open: false,
  contentBase: neutrino.options.source,
  hot: true,
  historyApiFallback: true,
  publicPath: '/',
  headers: {
    host: 'localhost'
  },
  stats: {
    assets: false,
    children: false,
    chunks: false,
    colors: true,
    errors: true,
    errorDetails: true,
    hash: false,
    modules: false,
    publicPath: false,
    timings: false,
    version: false,
    warnings: true
  }
});
```

```js
// Using object or array middleware format

// Usage with default options
module.exports = {
  use: ['neutrino-middleware-dev-server']
};

// Usage with custom options (default options are shown)
module.exports = {
  use: [
    ['neutrino-middleware-dev-server', {
      https: false,
      port: 5000,
      host: 'localhost',
      public: 'localhost',
      open: false,
      contentBase: neutrino.options.source,
      hot: true,
      historyApiFallback: true,
      publicPath: '/',
      headers: {
        host: 'localhost'
      },
      stats: {
        assets: false,
        children: false,
        chunks: false,
        colors: true,
        errors: true,
        errorDetails: true,
        hash: false,
        modules: false,
        publicPath: false,
        timings: false,
        version: false,
        warnings: true
      }
    }]
  ]
};
```

By default this middleware will start a development server with Hot Module Replacement support on
`http://localhost:5000`. To enable HMR with your application, read the documentation of corresponding Neutrino
preset or middleware.

It is recommended to call this middleware only in development mode when `process.env.NODE_ENV === 'development'`.
More information about usage of Neutrino middleware can be found in the [documentation](https://neutrino.js.org/middleware).

## Middleware options

`neutrino-middleware-dev-server` optionally accepts an object with several options to override the default behavior.
This object, as seen used above, can accept any
[property that is accepted by Webpack Dev Server](https://webpack.js.org/configuration/dev-server/). In addition, you
may also specify the following options:

- `open`:  Optional Boolean value to open the project in the a tab of the default browser. Default is `false`.

## Contributing

This middleware is part of the [neutrino-dev](https://github.com/mozilla-neutrino/neutrino-dev) repository, a monorepo
containing all resources for developing Neutrino and its core presets and middleware. Follow the
[contributing guide](https://neutrino.js.org/contributing) for details.

[npm-image]: https://img.shields.io/npm/v/neutrino-middleware-dev-server.svg
[npm-downloads]: https://img.shields.io/npm/dt/neutrino-middleware-dev-server.svg
[npm-url]: https://npmjs.org/package/neutrino-middleware-dev-server
[spectrum-image]: https://withspectrum.github.io/badge/badge.svg
[spectrum-url]: https://spectrum.chat/neutrino

---
_Source: https://npm.io/package/neutrino-middleware-dev-server · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
