ESM Loaders: Enhancing Module Loading in Node.js
summary
Claims that ESM loaders let Node.js change resolution and loading phases and shows working code: a tiny overrides.json mapping loader that redirects specifiers, an HTTP loader using fetch to pull from esm.sh, and a TypeScript loader that runs esbuild transpile on the fly. Examples run with --loader, chain together (HTTP + TS + overrides), and mostly work; some edge cases require Node 20 resolver fixes and fuller error handling but the demos succeed.
AI-written summary · about
chapters (10)
- 0:00ESM loaders in Node.js
- 1:14What is ESM and module loading
- 3:02Module execution phases
- 4:03Module loaders for resolution
- 5:26Overriding modules
- 8:38HTTP and TypeScript loading
- 13:37Specifier types in loaders
- 16:06TypeScript transpiling
- 17:30Chaining loaders
- 20:16Summary and future








