How to specify webpack-dev-server webpack.config.js file location

Mayday picture Mayday · Sep 7, 2016 · Viewed 18.3k times · Source

I am starting with webpack.

I have been able to specify to webpack the location of webpack.config.js like this:

"webpack --config ./App/webpack.config.js"

Now I am trying to use the webpack-dev-server with that file also, but I can not find how to specify the webpack.config.js location to it.

This is the relevant part of my package.json

"scripts": {
  "start": "webpack-dev-server --config ./App/webpack.config.js --progress --colors",
  "build": "webpack --config ./App/webpack.config.js --progress --colors"
}

How can I pass the ./App/ directory to my webpack-dev-server?

Answer

3stacks picture 3stacks · Aug 29, 2017

Just came across this issue. As spacek33z said, --config is correct. I couldn't find this in the webpack docs or the webpack-dev-server docs, so I found myself at this question.

e.g.

webpack-dev-server --config demo/webpack.config.js