48

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?

Mayday
  • 4,680
  • 5
  • 24
  • 58

2 Answers2

49

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

3stacks
  • 1,880
  • 1
  • 16
  • 21
15

For newbies like me:

Mention the config path in package.json similar to below:

{
  "name": "abc",

  "version": "0.0.1",

  "description": "description",

  "main": "index.js",

  "scripts": {
    "dev": "webpack-dev-server --config ./client/webpack.config.js",
    "build": "webpack --config ./client/webpack.config.js"
   }
}
סטנלי גרונן
  • 2,917
  • 23
  • 46
  • 68