Why it’s time to go ‘ESM only’
#566 — February 11, 2025
🏖️ We’re taking next week off, so the next issue will be on Tuesday, February 25. Feel free to hit reply and send in any submissions!
__
Peter Cooper, your editor.
How to Publish ESM-Based npm Packages with TypeScript — Now that you can use the ES modules (almost) everywhere, it’s worth understanding how to package them up for use with npm. Axel digs into everything you need to know and shares some useful tools too.
Dr. Axel Rauschmayer
Node v22.14.0 (LTS) Released — The latest stable/LTS release of Node gets the usual raft of bug fixes and tweaks. Among the more notable ones are TypeScript support for code evalled via stdin, a new –disable-sigusr1 flag, assert.register(), and t.assert.fileSnapshot().
Antoine du Hamel
Troubleshoot Node.js App Performance with Datadog APM — Datadog’s distributed tracing provides end-to-end visibility into requests wherever they go, across hosts, containers, and service boundaries. With rich dashboards, and algorithmic alerts, Datadog provides your team with the tools they need to optimize modern applications.
Datadog sponsor
IN BRIEF:
🎥 I wanted to turn some CSS animations into MP4 videos, but didn’t want to do the screen recording myself. Puppeteer, Node and fluent-ffmpeg to the rescue! Here’s my code to headlessly turn HTML into video.
🔠 GitHub has updated its fantastic family of Monaspace monospace coding fonts to support Nerd Fonts and include many more glyphs, extra 0 character designs, extra ligatures, and more.
Unflagged support for require(esm) is being backported to Node 20.
Why to Move On to ‘ESM-Only’ — The march to using ES modules has been going on for years now and if you’re still holding out, there’s probably a good reason why. While you can maintain packages that support both ESM and CommonJS approaches, Anthony thinks it’s finally time to go ‘ESM only’ and explains why here.
Anthony Fu
Node v20.18.3 (LTS) Released — The main update is the backporting of import attributes and JSON modules is now considered stable.
Marco Ippolito
Want to Roll Your Own Autoscaling? Here Are Our Secrets 🤫 — Does it make sense for us to write this guide? No! Did we do it anyway? Yes! We did it for you ❤️
Judoscale sponsor
📄 A Checklist for Your tsconfig.json Dr. Axel Rauschmayer
📄 Do I Need This Node Dependency? Brian Muenzenmeyer
📄 How to Write Cypress Tests That Don’t Suck Jonathan Chaffer
🛠 Code & Tools
import-in-the-middle: A Module Loading Interceptor — Back in my day Malcolm was in the middle, but now you can intercept the loading of ES modules in Node with this – handy if you want to modify them in some way. There’s also require-in-the-middle if you’re a bit more oldschool.
Node.js Team
ffast: An Experimental Node.js FFI Library — A proof of concept for bringing all the low level bindings necessary into JS-land for creating FFI wrappers from JavaScript itself, without needing things like libffi. Works (with many caveats, the author says) on Linux x64/ARM64 and macOS/ARM64.
Billy Whizz
Human Regex: Human-Friendly Regular Expression Builder with English-Like Syntax — After 8 years of Perl, regexes are my bread and butter, but I’d say most developers aren’t big fans 😉 This library offers a more natural fluent-style option. Magic Regexp and Super Expressive are other options in this space.
Ridwan Ajibola
Pundit-TS: Organize Your Authorization Logic with Full Type-Safety — Inspired by Ruby’s Pundit library, Pundit-TS offers a TypeScript flavored way to implement role-based and attribute-based access control models in your app.
Fatih Kaya
web-worker 1.5: Consistent Web Workers for the Browser and Node — Want to publish npm modules that use Web Workers and that work in both Node anbd client-side? In Node, it works as a web-compatible Worker implementation atop worker_threads. In the browser, it’s an alias for Worker.
Jason Miller
fast-folder-size: Calculate the Total Size of a Directory — Works as both a CLI app or Node module.
Simone Busoli
ioredis 5.5: Robust, Performant, Full-Featured Redis Client for Node
Zihua Li
remove-unused-vars — An experimental new tool for removing unused variables from code.
Lars Kappert
📰 Classifieds
Start selling to enterprise faster with WorkOS by Adding SSO, SCIM, and RBAC to your B2B SaaS app in minutes—not months.
📈 Is your app facing a traffic spike (e.g. fintechs facing the upcoming tax season)? Join Matteo Collina for tips on scaling Node.js apps during high-pressure periods.
Register your badge for Node Congress! Learn Fullstack, JS backends & DevOps from top Node.js experts, including TSC members & 15+ speakers!
pnpm 10.3 – The fast, efficiency-focused package manager adds a strict-dep-builds option to exit with a non-zero exit code if any dependencies have unreviewed build scripts.
Express Zod API 22.8 – Quick schema validation and custom middleware.
Mongoose 8.10 – Popular MongoDB object modeling library.
Typegoose 12.11 – Define Mongoose 8.10 models as TypeScript classes.
Jasmine 5.6 – Testing framework for browsers & Node.
Globby 14.1 – User-friendly glob matching.
📢 Elsewhere in JavaScript
A quick roundup of some of other interesting stories in the broader JavaScript landscape, in case you’ve missed them:
Alex MacArthur shows off seven different ways to break up long tasks in JavaScript. Only a few of them work in Node, with the focus being on browser use cases where freezing up the UI is a true no go.
Beej, author of numerous popular guides to programming concept, has released Beej’s Guide to Git, a great zero-to-expert online resource for using the world’s most popular DVCS.
Nx user? Nx has a whole new experience for Nx workspaces that’s faster, more efficient, and solves a variety of issues with TypeScript editor support for large monorepos.
📺 From the creators of the fantastic ▶️ Node.js: The Documentary comes ▶️ a new documentary about the Angular framework.