~/talk

ESM Loaders: Enhancing Module Loading in Node.js

Talkat NodeTLV 2023 · on Wednesday, 2023-06-28· [nodejs, javascript]
slides:none on file

Explains how ESM loaders hook the module resolve/load hooks to change resolution and file reads, with concrete examples: an overrides.json resolver that rewrites specifiers, an HTTP loader that uses built-in fetch, and a TypeScript transformer using esbuild transpiler to return JS source. Shows chaining multiple loaders via --loader flags, implements cache-busting by appending gen=query to resolved URLs, and details Node 20+ changes (loader workers, message ports and SharedArrayBuffer+Atomics) needed to make API-driven features work — examples compile and run after those fixes.

AI-written summary · about

  1. 0:00Introduction to ESM loaders
  2. 1:47What are ESM modules
  3. 4:36Module loaders overview
  4. 6:01Overriding module resolution
  5. 9:34Enhancing the loading phase
  6. 12:02Handling HTTP URLs in loaders
  7. 15:31Transpiling TypeScript with loaders
  8. 18:05Chaining multiple loaders
  9. 21:35Caching behavior in ESM
  10. 22:36Clearing module cache
  11. 25:22Loader communication in Node 20
  12. 28:41Summary and future of ESM loaders
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.