官术网_书友最值得收藏!

Webpack module bundler

It's finally time to set up our fully-featured development environment. You'll probably be wondering what Webpack is and what's it got to do with a development environment. Or perhaps, you are familiar with tools such as gulp or grunt and are wondering how Webpack is different from them.

If you have used gulp or grunt before, they are task runners. They execute a specific set of tasks to compile, transform, and minify your code. There is also a tool called Browserify, which lets you use require() in browsers. Usually, a development environment with gulp/grunt involves executing various commands using different sets of tools, such as Babel, Browserify, and so on, in a specific order to generate our desired output code. But Webpack is different. Unlike task runners, Webpack doesn't run a set of commands to build the code. Instead, it acts as a module bundler.

Webpack goes through your JavaScript code and looks for import, require, and so on to find files dependent on it. Then, it loads the files into a dependency graph and, in turn, finds those files, dependencies. This process goes on until there are no more dependencies. Finally, it bundles the dependency files together with the initial file into a single file using the dependency graph it built. This functionality is very useful in modern JavaScript development, where everything is written as a module:

Webpack is being adopted as the bundler of popular modern frameworks, such as React, Angular, and Vue. It is also a good skill to have on your resume.
主站蜘蛛池模板: 弥勒县| 深州市| 赤水市| 长顺县| 锡林郭勒盟| 绥芬河市| 简阳市| 阿勒泰市| 清镇市| 石河子市| 霸州市| 子长县| 台南县| 波密县| 宾阳县| 含山县| 呼图壁县| 大庆市| 乌拉特中旗| 体育| 江安县| 新化县| 化德县| 江孜县| 巴彦淖尔市| 安丘市| 东山县| 麦盖提县| 泰宁县| 临武县| 宜川县| 香格里拉县| 庆安县| 武夷山市| 淮阳县| 五莲县| 双流县| 泸水县| 汕尾市| 四川省| 梓潼县|