45

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
  • 3,482
  • 2
  • 15
  • 44

2 Answers2

45

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,500
  • 1
  • 9
  • 18
13

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,740
  • 21
  • 43
  • 62