How to learn webpack better?

first of all, emphasize that it is better rather than faster.

I have been in contact with webpack for some time, but my level is still very bad. I occasionally look at the documentation and other people"s code, but I find that I even have a wrong understanding of webpack, let alone how it works.

I only know that it is used for packaging, usually work in the project configuration is leader configuration, just use it directly, basically did not write the project configuration, look at the official documents is only a general understanding, really to write their own time can not write out, most of the existing configuration can still be understood.

what bothers me most is that I don"t seem to know how it works. For example, in the vue project, the css, development environment of the development environment and production environment is inserted into head in the form of style, and the production environment is in the form of link. I don"t even know why. After being a colleague, I really think it"s a long way to learn webpack well! There is no direction at all. Read the document? Watch the video? Write demo?

Mar.23,2022

the best way is to build a scaffolding yourself and check where you don't know. When the scaffolding can be fully used, you will have a general idea, and then you will have an in-depth understanding of the principle, and then write loader,plugin, to achieve small functions.


it is recommended to see nodejs and webpack source code. Because webpack is developed by nodejs


is of course more hands-on writing, do not understand to check the documentation, as for reading the source code I think it is not necessary.


means you don't understand the configuration. Take a look at this introductory document and learn about some loader and plugin,. You will understand that webpack generally calls loader parsing by calling plug-ins. Find plug-ins according to specific functions or write webpack


suggest you write some small projects, interest projects, and open source on github. Keep updating.
webpack still need to know nodejs first

Menu