How to specify webpack-dev-server webpack.config.js file location
21,037
Solution 1
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
Solution 2
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"
}
}
Related videos on Youtube
Comments
-
Mayday over 4 years
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?
-
spacek33z over 7 yearsUsing
--config
should work. What error do you get?
-
-
Iago Barreto over 3 yearsCan you add a configuration file example? as webpack.config.js