About
The WebPack dev is a little Node.js Express web server that implements live-reloading
Articles Related
Starting
Manually
In the root directory (where your WebPack - webpack.config.js is), run:
node_modules/.bin/webpack-dev-server
This will start a server, listening on connections from localhost on port 8080.
As Node Script
As npm script
{
// ............
"scripts": {
"start": "webpack-dev-server"
},
"dependencies": {
"d3": "^4.10.2"
},
"devDependencies": {
"webpack": "^3.6.0",
"webpack-dev-server": "^2.8.2"
}
}
Then:
npm start
Configuration
const path = require('path');
module.exports = {
devServer: {
contentBase: path.join(__dirname, "dist"),
compress: true,
port: 9000
}
}
where a web server will be started:
- in the dist directory
- on the port 9000
- with compression on.