[PR #5703] feat: esm only #14413

Closed
opened 2026-04-13 09:27:44 -05:00 by GiteaMirror · 0 comments
Owner

Original Pull Request: https://github.com/better-auth/better-auth/pull/5703

State: closed
Merged: Yes


We are no longer maintaining CJS, since some of our deps are already ESM-only. And also since Node.js already support CJS-ESM interop, we don't need CJS anymore


Summary by cubic

Switch the repo to ESM-only. Removes CommonJS builds and require exports across all packages to match ESM-only dependencies and simplify builds.

  • Refactors

    • Dropped CJS output and removed .cjs/.d.cts entries in package.json exports for better-auth, core, expo, sso, stripe, and telemetry.
    • Updated tsdown configs to build ESM only.
  • Migration

    • Replace require('...') with ESM imports, or use dynamic import in CJS (await import('...')).
    • No .cjs files are published. Ensure TypeScript uses NodeNext/Bundler module resolution to consume .d.ts from ESM.

Written for commit 63bec1cd76. Summary will update automatically on new commits.

**Original Pull Request:** https://github.com/better-auth/better-auth/pull/5703 **State:** closed **Merged:** Yes --- We are no longer maintaining CJS, since some of our deps are already ESM-only. And also since Node.js already support CJS-ESM interop, we don't need CJS anymore <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Switch the repo to ESM-only. Removes CommonJS builds and require exports across all packages to match ESM-only dependencies and simplify builds. - **Refactors** - Dropped CJS output and removed .cjs/.d.cts entries in package.json exports for better-auth, core, expo, sso, stripe, and telemetry. - Updated tsdown configs to build ESM only. - **Migration** - Replace require('...') with ESM imports, or use dynamic import in CJS (await import('...')). - No .cjs files are published. Ensure TypeScript uses NodeNext/Bundler module resolution to consume .d.ts from ESM. <sup>Written for commit 63bec1cd7606f9ba08e8281f73c4cd68ec90a003. Summary will update automatically on new commits.</sup> <!-- End of auto-generated description by cubic. -->
GiteaMirror added the pull-request label 2026-04-13 09:27:44 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#14413