Lab 10: Module Federation
Step 1: ESM Module System Internals
app.mjs
└── import './lib.mjs' ← resolved at parse time (static)
└── import './utils.mjs' ← recursive
└── const mod = await import(x) ← dynamic import: resolved at runtimeStep 2: import.meta — The ESM Context Object
import.meta — The ESM Context ObjectStep 3: Dynamic Import with Assertions
Step 4: Module Graph Caching
Step 5: vm.Module — SyntheticModule & SourceTextModule
vm.Module — SyntheticModule & SourceTextModuleStep 6: CJS ↔ ESM Interop — The Gotchas
Step 7: Dual-Mode Package (CJS + ESM)
Step 8: Capstone — Plugin System with vm.Module
Summary
Concept
API
Key Point
Last updated
