Learn JavaScript

Lesson 5 of 9 · Modules: import, export and How Files Find Each Other

Module 11 · Modules: import, export and How Files Find Each Other

Under the Hood: Live Bindings, the Three Phases, the Module Wrapper and the Bundler

ProReading

Lesson 01 promised that CommonJS behaves differently from ES modules when an exported value changes. Lesson 03 showed one cycle failing and hinted at one that works. Both facts come from how each system is built. This lesson opens both machines.

Checking what this lesson needs for you…

What is inside Under the Hood: Live Bindings, the Three Phases, the Module Wrapper and the Bundler

  1. Live bindings against copies
  2. Three phases: construct, link, evaluate
  3. Evaluation order, depth first
  4. The module map and the cache
  5. The CommonJS module wrapper
  6. A tiny require, by hand
  7. CommonJS cycles: a half-filled object
  8. Lab: the first load against the cache
  9. What a bundler does