我在我的应用中使用了express
API,因此我使用webpack-dev-middleware
和webpack-hot-middleware
。
当我通过API使用webpack --color
时,我正试图弄清楚如何获取webpack
选项。
这就是我现在所拥有的:
const webpack = require('webpack')
const webpackConfig = require('../../webpack.config')
const compiler = webpack(webpackConfig)
const webpackDevMiddleware = require('webpack-dev-middleware')(compiler, {
noInfo: true
})
const webpackHotMiddleware = require('webpack-hot-middleware')(compiler)
app.use(webpackDevMiddleware)
app.use(webpackHotMiddleware)
我目前正在使用webpack@2.2.0-rc.3
。
答案 0 :(得分:4)
在这里,添加
stats: {
colors: true
}
您的选择,例如:
const webpackDevMiddleware = require('webpack-dev-middleware')(compiler, {
noInfo: true,
stats: {
colors: true
}
})
使用webpack 2.2.1和webpack-dev-middleware 1.10.1进行测试。