1. Install CNPM i webpack-dev-server--save-dev in terminal
2. Execute webpack-dev-server after configuration, this time will error
There is an error, just configure the scripts in the Pagejson.
3. After downloading, you need to configure the next Devserver
Const PATH = require (' path ');//Introducing Pathmodule.exports={//exposed.entry:{Entry:'./src/entry.js ', Entry2:'./src/entry2.js ' }, //Portal File Configurationoutput:{path:path.resolve (__dirname,' Dist '),//Dist Absolute Path //filename: ' bundle.js 'FileName: ' [name].js '//the exported and imported file names are identical after packing},//Export File Configurationmodule:{},//modules, such as CSS, image conversion, compressionPlugins:[],//plug-ins, multiple plugins, so are arraysdevserver:{contentBase:path.resolve (__dirname,' Dist '), Host:' 172.16.64.59 ', Compress:true, Port:8080 } //Configuring the Webpack service}
Host is your own IP address, port is the port number
4. Once configured, perform NPM run server on the terminal to
Copy the address into the browser, you can see the effect, and the implementation of the hot update
Webpack QuickStart--Profiles: Services and hot updates