You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
607 B
JavaScript
26 lines
607 B
JavaScript
7 years ago
|
const webpack = require('webpack')
|
||
|
const clientConfig = require('./webpack.client.config')
|
||
|
|
||
|
module.exports = function setupDevServer(app) {
|
||
|
//hot middleware
|
||
|
clientConfig.entry.app = [
|
||
|
'webpack-hot-middleware/client',
|
||
|
clientConfig.entry.app
|
||
|
]
|
||
|
|
||
|
clientConfig.plugins.push(
|
||
|
new webpack.HotModuleReplacementPlugin(),
|
||
|
new webpack.NoEmitOnErrorsPlugin()
|
||
|
)
|
||
|
|
||
|
const clientCompiler = webpack(clientConfig)
|
||
|
app.use(
|
||
|
require('webpack-dev-middleware')(clientCompiler, {
|
||
|
stats:{
|
||
|
colors: true
|
||
|
}
|
||
|
})
|
||
|
)
|
||
|
app.use(require('webpack-hot-middleware')(clientCompiler))
|
||
|
}
|