neutrino-middleware-dev-server

Neutrino middleware for starting a webpack-dev-server

This package is deprecated. See: https://neutrinojs.org/migration-guide/#neutrino-v7-to-v8
Last updated 3 years ago by eliperelman .
MPL-2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install neutrino-middleware-dev-server 
SYNC missed versions from official npm registry.

Neutrino Dev Server Middleware

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

NPM version NPM downloads Join the Neutrino community on Spectrum

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

❯ yarn add neutrino-middleware-dev-server

npm

❯ 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:

// 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
  }
});
// 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.

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. 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 repository, a monorepo containing all resources for developing Neutrino and its core presets and middleware. Follow the contributing guide for details.

Current Tags

  • 7.4.0                                ...           latest (3 years ago)

29 Versions

  • 7.4.0 [deprecated]           ...           3 years ago
  • 7.3.3 [deprecated]           ...           3 years ago
  • 7.3.2 [deprecated]           ...           3 years ago
  • 7.3.1 [deprecated]           ...           3 years ago
  • 7.3.0 [deprecated]           ...           3 years ago
  • 7.2.3 [deprecated]           ...           3 years ago
  • 7.2.1 [deprecated]           ...           3 years ago
  • 7.1.10 [deprecated]           ...           3 years ago
  • 7.1.3 [deprecated]           ...           3 years ago
  • 7.1.2 [deprecated]           ...           3 years ago
  • 7.1.1 [deprecated]           ...           3 years ago
  • 7.1.0 [deprecated]           ...           3 years ago
  • 7.0.2 [deprecated]           ...           3 years ago
  • 7.0.1 [deprecated]           ...           3 years ago
  • 7.0.0 [deprecated]           ...           3 years ago
  • 6.2.1 [deprecated]           ...           3 years ago
  • 6.2.0 [deprecated]           ...           3 years ago
  • 6.1.8 [deprecated]           ...           3 years ago
  • 6.1.5 [deprecated]           ...           3 years ago
  • 6.1.4 [deprecated]           ...           3 years ago
  • 6.1.2 [deprecated]           ...           3 years ago
  • 6.1.1 [deprecated]           ...           3 years ago
  • 6.1.0 [deprecated]           ...           3 years ago
  • 6.0.5 [deprecated]           ...           3 years ago
  • 6.0.4 [deprecated]           ...           3 years ago
  • 6.0.3 [deprecated]           ...           3 years ago
  • 6.0.2 [deprecated]           ...           3 years ago
  • 6.0.1 [deprecated]           ...           3 years ago
  • 6.0.0 [deprecated]           ...           3 years ago
Downloads
Today 0
This Week 0
This Month 32
Last Day 0
Last Week 0
Last Month 3
Dependencies (4)
Dev Dependencies (0)
None

Copyright 2014 - 2016 © taobao.org |