01
Module Systems
The move from global scope pollution to module scope, the two module systems' binding and loading models, interoperability, and dynamic import.
- 01 The Need for Modules The name-collision problem born from sharing the global scope, the namespace pattern built with closures, and module scope's answer to that problem.
- 02 ES Modules Named and default export, import's live-binding behavior, binding coming before evaluation, and the opportunity static structure gives to tree shaking.
- 03 CommonJS The call-based loading model, the module wrapper and cache, the difference between a value copy and a live binding, the two systems' behavior on circular dependencies, and interoperability.
- 04 Dynamic Imports The promise-returning import expression, conditional loading with a computed specifier, the module registry's single-evaluation guarantee, and the cost balance of code splitting.