Webpack Basic Use (i)

Source: Internet
Author: User

Install webpack:0. Webpack npm Install webpack-g in the global installation (if you do not have a webpack in the global, the local will not be recognized) 1. Enter the project installation directory via the command line, 2. Enter NPM init 3.npm webpack --save-dev

Webpack Packaging: Format webpack The file name after packaging the file name that you want to package for example: Webpack helloworld.js helloWorld.bundel.js

The successful operation will give us a part of the information: 1. Hash: Hashed 2.version:webpack version 3.Time: The time taken by this package is 4.Asset: This package generates a file of 5. Size This is a package of sizes 6. Chunks: This is a packed chunk

7.Chunk Names: Quick name for this package

When packaging, use--watch to monitor the transformation of the package file, so that the file changes package for example: Webpack helloworld.js helloWorld.bundel.js--watch

Loader reference: Some of the packaging process needs us to install some loader (such as CSS files, style) npm install Css-loader Style-loader--save-dev, also need require (' style-l oader!css-loader!. /style.css ') =

You can also add--module-bind ' Css=style-loader!css-loader ' when packing (recommended) For example: Webpack helloworld.js helloWorld.bundel.js--module-b IND ' Css=style-loader!css-loader '

Webpack parameters: 1:watch: Monitor 2.proggress: Packaging process 3.display-modules: View packaged modules 4.display-reasons: Why did you pack this module?



Webpack Basic Use (i)

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.