Configuration of the Webpack-dev-server

Source: Internet
Author: User

# Webpack-dev-server Configuration implementation feature in Webpack

The first is to use NPM to download NPM install Webpack-dev-server--save-dev

Open webpack.config.js Add configuration information, need to modify output, add Devserver,
Plugins

This is where you write absolute paths in output.
...
output:{
Path: ' Lib ',//My path here is under the Lib folder
Publicpath: "http://127.0.0.1:8080/lib/",
FileName: ' Bundle.js '
},
...

...
devserver:{
Historyapifallback:true,
Hot:true,
Inline:true,
Progress:true,
},
...
plugins:[
New Webpack. Defineplugin ({
' Process.env.NODE.ENV ': "Development"
}),
New Webpack. Hotmodulereplacementplugin ()
]
This is a good configuration. The next step is to start it, and we can customize the command. In the Package.js
...
"Scripts": {
"Start": "Webpack-dev-server--inline"//not added here-hot
},
...

Save, OK. Enter NPM run start
When you are finished running, open your browser and enter http://localhost:8080/lib/index.html, then try again.

Configuration of the Webpack-dev-server

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.