Problems encountered during the course of learning webpack3.x

Source: Internet
Author: User

This blog main record is I in the process of learning webpack3.x problems (although these days 4.0 just came out, but I would first learn 3.x it)

1, the configuration file can be used Webpack service and hot update, the steps are as follows:

① First Download: webpack-dev-server
CNPM Install Webpack-dev-server--save-dev

② Configuration Webpack.config.js

Module.exports = {    //config Portal file    entry:{},/    /config Export file    output:{},    //config module: Mainly parsing CSS and image conversion compression functions    module:{},    //configure plug-in    plugins:[],    //Configure development Services features      devserver:{        //Set BASIC directory Structure        contentbase: Path.resolve (__dirname, ' dist '),       //Set the IP address of the server, you can use the IP address, or you can use localhost        host: ' localhost ',       // Server-side compression whether        to turn on compress:true,       //Configure service port ha       port:2018    }          }    

③ Modifying Package.json files

"Scripts": {    "server": "Webpack-dev-server"   //Modify this location  },

④ Open Terminal: win+r,cmd, switch to project directory, run: NPM run server

NPM Run Server

The following problems are encountered:

* Problem Description: I am currently using the Webpack is 3.6.0 version, the download of Webpack-dev-server is 3.1.0 version (the latest version at this time), because this version is too high to elicit this problem, the solution is to re-download a lower version of the Webpack-dev-ser ver, I downloaded the 2.8.2 version of the

CNPM i-d [email protected]

  

Problems encountered during the course of learning webpack3.x

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.