0

I have an express API I'm using in my app so I am using webpack-dev-middleware and webpack-hot-middleware.

I'm trying to figure out how to get the webpack --color option when I use webpack through the API.

This is what I have right now:

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)

I am currently using webpack@2.2.0-rc.3.

Brennan Cheung
  • 4,271
  • 4
  • 30
  • 29

1 Answers1

4

Here, add

stats: {
  colors: true
}

to your options, like:

const webpackDevMiddleware = require('webpack-dev-middleware')(compiler, {
  noInfo: true,
  stats: {
    colors: true
  }
})

Check out the usage section.

Tested with webpack 2.2.1 and webpack-dev-middleware 1.10.1.

Miha Markic
  • 3,158
  • 22
  • 28