Webpack Basic Use (ii)

Source: Internet
Author: User

Configuration of the Webpack.config.js file: input: module.exports={

Entry://import file, You can make string type such as: './src/script/main.js ' can also use the form of an array such as: ['./src/script/main.js ', './src/script/main1.js ']

Output:{//packaging after the file

Path://__dirname + packaged File-put path for example: __dirname + '/dist '

Filename://the file name after packaging

}

}

[recommended configuration for]webpack.config.js file: input: module.exports={

Entry: {//portal File

Page1: ',//can make string type such as: './src/script/main.js ' can also be used in the form of arrays such as: ['./src/script/main.js ', './src/script/main1.js ']

Page2: "//ibid.

}

Output:{//packaging after the file

Path://__dirname + packaged File-put path for example: __dirname + '/dist '

filename://[name] the file name after packaging for Example: ' [name].js ' three placeholder 1. [name]: replaced by the name of the Block (page1,page2) 2. [hash]: Replace with the compiled hash value of 3. [chunkhash]: replaced by the hash of the block

}

}

Use NPM to add parameters to wabpack: configure Wabpack under scripts in Package.json for example: "webpack": "webpack--config webpack.config.js--progress-- Display-modules--colors--watch "

Webpack Basic Use (ii)

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.