Starts webpack dev server when running metalsmith
npm install metalsmith-webpack-dev-server$ npm install metalsmith-webpack-dev-server
``js
var metalsmith = require('metalsmith');
var webpackDevServer = require('metalsmith-webpack-dev-server');
var webpackConfig = require('./webpack.config.js');
metalsmith(__dirname)
.use(webpackDevServer(webpackConfig))
.build(function(err) {
if (err) { throw err; }
});
`
This will start webpack-dev-server on localhost:8081 using default configuration. Pass webpack-dev-server options as a second argument.
`js
var metalsmith = require('metalsmith');
var webpackDevServer = require('metalsmith-webpack-dev-server');
var webpackConfig = require('./webpack.config.js');
metalsmith(__dirname)
.use(webpackDevServer(webpackConfig, {
hot: true, // Enable HMR
proxy: {
'*': 'http://localhost:8080'
},
// webpack-dev-middleware options
quiet: true,
noInfo: true,
publicPath: 'http://localhost:8081/',
stats: {colors: true}
}))
.build(function(err) {
if (err) { throw err; }
});
`
For more information about webpack-dev-server options see: https://webpack.github.io/docs/webpack-dev-server.html
Your webpack config. See the [webpack configuration][webpack configuration] documentation for details.
$3
Type: Object`webpack-dev-server options. See https://webpack.github.io/docs/webpack-dev-server.html for details.
MIT