TheLarkInn / artsy-webpack-tour

Annotations on webpack source code in a pseudo-guided fashion.
524 stars 34 forks source link
tutorial webpack webpack-tutorial

artsy-webpack-tour

Annotations on webpack source code in a pseudo-guided fashion.

Just an Experiment

My goal as one of the maintainers for webpack is being able to help developers better understand how webpack works.

Demystify the tool so it helps you become more comfortable understanding how to use it and contributing to our source code and supporting packages.

Have a question?

The whole goal is to teach you how to use webpack, therefore please ask questions about the annotations you see inside of a github issue, and I will help you clarify any parts of what is seen below. There is NO wrong question.

Disclaimer: This may not match master!

I will likely not keep this up to date with every change in master on webpack/webpack. Rather, the purpose is to teach how to read and view the flow of the compilation lifecycle through webpack.

Table of Contents

  1. WebpackOptionsApply.js (List of plugins)
  2. WebpackOptionsApply.js (Explanation of Options)
  3. WebpackOptionsApply.js (Native modules)
  4. WebpackOptionsApply.js (Source Map Flavors)
  5. WebpackOptionsApply.js (More module madness!)
  6. WebpackOptionsApply.js (after plugins)
  7. Compiler.js (The Complier's Constructor)
  8. Compiler.js (The Complier's Execution Process)
  9. Compiler.js (The Complier's Execution Process Part 2)
  10. Compiler.js (Compilation prelude)
  11. Compilation.js (Welcome to the compilation)
  12. Compilation.js (Welcome to the compilation)
  13. Compilation.js
  14. Compilation.js (Building chains)
  15. NormalModuleFactory.js
  16. NormalModuleFactory.js
  17. NormalModuleFactory.js
  18. NormalModule.js
  19. Compilation.js (Back to compilation!)
  20. Compilation.js
  21. NormalModule.js
  22. NormalModule.js
  23. Compilation.js
  24. Compilation.js
  25. Compilation.js
  26. Compilation.js
  27. Compiler.js
  28. Compilation.js

Text Transcripts

To make this searchable, the text of each image has been transcribed. The title of each transcript anchors to the respective image. The transcripts are not made to be read through, rather they provide a tool to search out a specific section based on the commentary.

Help Wanted ❤😍💕❤😍💕❤😍💕❤😍💕❤😍

Version (webpack 2.2.1+ from master)

WebpackOptionsApply.js (List of plugins)

Step 1

WebpackOptionsApply.js (Explanation of Options)

Step 2

WebpackOptionsApply.js (Native modules)

Step 3

WebpackOptionsApply.js (Source Map Flavors)

Step 4

WebpackOptionsApply.js (More module madness!)

Step 5

WebpackOptionsApply.js (after plugins)

Step 6

Compiler.js (The Complier's Constructor)

Step 7

Compiler.js (The Complier's Execution Process)

Step 8

Compiler.js (The Complier's Execution Process Part 2)

Step 9

Compiler.js (Compilation prelude)

Step 10

Compilation.js (Welcome to the compilation)

Step 11

SingleEntryPlugin.js (Down the rabbit hole!)

Step 12

Compilation.js

Step 13

Compilation.js (Building chains)

Step 14

NormalModuleFactory.js

Step 15

NormalModuleFactory.js

Step 16

NormalModuleFactory.js

Step 17

NormalModule.js

Step 18

Compilation.js (Back to compilation!)

Step 19

Compilation.js

Step 20

NormalModule.js

Step 21

NormalModule.js

Step 22

Compilation.js

Step 23

Compilation.js

Step 24

"for now, lets consider this the entry module."
"the final call from addEntry fn"
"unflatten deps"
"deps. can come from some 'resourece' aka file/resolved location, this dedupes the loc. and groups by [[dep1, dep2],...[block],...]"
"hard to explain; 100% a module is a dep block dep block is hisgest super class that exists to rep. dep. relationships"
"time to add all deps & bfs graph traversal"
"OMG I JUST Figureed out DependenciesBlock fully just now!!!"
"So the whole point is that deps can be uniq bit from the same place"

Compilation.js

Step 25

Compilation.js

Step 26

Compiler.js

Step 27

Compilation.js

Step 28