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?
The easiest way to get your webpack. config. js file to work is to place it at the top level of your project's folder structure along with your package.
By default, webpack-dev-server serves the config's output. filename on localhost:8080/ (eg. localhost:8080/bundle. js ).
publicPath specifies the virtual directory in web server from where bundled file, app. js is going to get served up from. Keep in mind, the word server when using publicPath can be either webpack-dev-server or express server or other server that you can use with webpack.
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
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" } }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With