Shipping Node.js packages in 2025
summary
Node now makes a concrete interoperability claim: require can load ESM after an implementation landed behind a flag in Node 22, unflagged in 23 and backported to 20 LTS, and it actually works so packages start migrating. Ecosystem numbers: >80% of high‑impact packages still ship CommonJS, only ~6/5000 use top‑level await. Practical tools and fixes: TypeScript 5.7 rewriteRelativeImportExtensions, process.getBuiltinModule and createRequire. Real win: Storybook 10 sheds 15% of node_modules by going ESM‑only.
AI-written summary · about
chapters (14)
- 0:00Modern Node.js package shipping
- 1:10Node.js package formats history
- 3:20ESM vs CommonJS interoperability
- 8:17require() loads ESM in Node.js
- 10:27require() ESM feasibility
- 13:20Node.js LTS supports require() ESM
- 14:43Dual packages unnecessary
- 15:03Migrate dual packages to ESM
- 19:58package.json for ESM-only
- 20:40Migrate full ESM packages
- 22:27Migrate CommonJS to ESM
- 26:26Default and named exports in ESM
- 27:30Dynamic loading in ESM
- 29:33Best practices for Node.js packages
related talks
32mES Modules in Node JS
29mExtra Special Modules
22mPlease wait... loading: a tale of two loaders
37mThe time to migrate to ESM in Node.js is now!
48mTomorrow's ES modules today
32mPlease Wait... Loading: A Talk of Two Loaders
48mESM: EcmaScript Modules in browser and NodeJS. It's about time!
32mNode.js Q&A session
