Webpack3+react Building Apps

Source: Internet
Author: User

Webpack

Webpack is a packaging tool, the scientific name is called the Module Packager, all the modules packaged into one or a small number of files, so that you just load a small number of files to run the entire application, without the need to load a lot of pictures, CSS files, JS files, font files and so on as before.

Compared to Gulp/grunt's automated build tool, Webpack is relatively weak in js,css compression, code checking, and compilation. Because plug-ins are not broad enough. So someone will combine the two together, a better way is to use NPM script instead of gulp to complete the task.

A complete configuration is like this. A little bit more, but it doesn't matter. Part of it is actually totally useless.

Package JS

Need to develop entry and output, in the JS file using import syntax to write module dependencies. You can load all the dependencies smoothly.

Module.exports = {    './src/index.js',    output: {        '  ./dist'),        'bundle.js'    }} 

Loader and plugin, what's the difference?
Loader (loader), heavy in the "load" word, is used to preprocess files, only for loading different types of files when the different types of files to do the corresponding processing. and plugin (plug-in), as the name implies, is used to increase the function of Webpack, acting on the entire webpack construction process. In Webpack this large company, loader is the security uncle, responsible for the different personnel to enter the company's handling, and plugin is the company's different positions of staff, responsible for the company's various business, each to add a new business needs, we need to add a plugin.

Module Hot swap (HMR)

Update only the modules that have changed (replace, add, delete) without reloading the entire page (live load,livereload), which can significantly speed up development, once the hot mode of Webpack-dev-server is turned on, Hot mode attempts to update using HMR before attempting to reload the entire page.

Webpack3+react Building Apps

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.