webpack learning record

Why does webpack appear?

The front-end development technologies are various and complex, and different specifications and formats cause the front-end engine to not fully recognize these technical languages. For example: less, typescript, etc., you need to manually convert it into a language that the browser can recognize. When the project is large, such manual processing becomes particularly complicated. In order to automate this process, webpack appeared.


What is webpack?

Webpack is a module packaging tool. It is mainly responsible for analyzing the project structure, finding the source language, converting it into the target language, and other specified formats. Modular solution.


Compared with grunt and gulp?

Gulp can optimize the front-end development process, the way it works: In a configuration file, certain files are similar: specific steps of compilation, combination, compression and other tasks, and the tool will automatically complete it for you.

How webpack works: treat the project as a whole, start to find all the dependent files of your project through the given entry file index.js, use loaders to process them, and finally package them into one or more recognizable js files. Can handle different types of files.


how to use?

Initialization: npm init

安装:npm install -g webpack      // npm install --save-dev webpack

Write configuration files to achieve automation: webpack.config.js

Execute commands: npm run dev and so on


。。。。



Guess you like

Origin blog.csdn.net/u010682774/article/details/78893124