A developer shares their experience debugging and fixing ES Module compatibility issues in Emmett, a TypeScript event-driven library. The post covers the differences between CommonJS and ES Modules, how to properly configure package.json exports for dual module support, and how to set up a CI pipeline using npm pack, tarball installation, and grep-based error detection to catch compatibility regressions before publishing. The root cause turned out to be a tsup bundler misconfiguration where bundling was only enabled in production mode, leaving unbundled nested files that caused directory import errors in ES Module contexts.

21m read timeFrom event-driven.io
Post cover image
Table of contents
ES ModulesIssues with ES ModulesChecking the compatibility