The Rise of ESM-Only: Is the JavaScript Ecosystem Ready?

This post explores the current state of ESM (ECMAScript Module) adoption in the JavaScript ecosystem and argues for a transition to ESM-only packages. The author revisits a previous post advocating for dual CJS/ESM formats and explains the shift towards ESM-only. The rise of modern build tools like Vite and frameworks like Nuxt and SvelteKit has made ESM the dominant module system. Node.js's support for `require()`ing ESM modules further removes interoperability hurdles. While dual CJS/ESM packages served as a transition mechanism, they introduce significant maintenance overhead and interop issues. The author recommends ESM-only for new projects and provides guidance for different project types (browser, CLI). A new tool, Node Modules Inspector, is introduced to help analyze ESM adoption in project dependencies.