1、webpack.config.js
devServer:{
contentBase:__dirname+"/dist",
port:8080
},
2、package.json
"scripts": {
"build": "webpack",
"dev": "webpack-dev-server"
},
3、npm run dev即可
4、打开localhost:8080
相当于同时run build,run httpserver