Neutrino Dev Server Middleware
neutrino-middleware-dev-server
is Neutrino middleware for starting a Webpack Dev Server for fast development cycles.
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 formatconst devServer = ; // Usage with default optionsneutrino; // Usage with custom options (default options are shown)neutrino;
// Using object or array middleware format // Usage with default optionsmoduleexports = use: 'neutrino-middleware-dev-server'; // Usage with custom options (default options are shown)moduleexports = use: 'neutrino-middleware-dev-server' https: false port: 5000 host: 'localhost' public: 'localhost' open: false contentBase: neutrinooptionssource 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 isfalse
.
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.