Webpack QuickStart--Profiles: Services and hot updates

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.