[PR #5703] [MERGED] feat: esm only #31767

Closed
opened 2026-04-17 22:39:06 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/5703
Author: @himself65
Created: 10/31/2025
Status: Merged
Merged: 10/31/2025
Merged by: @himself65

Base: canaryHead: himself65/2025/10/31/esm


📝 Commits (1)

📊 Changes

12 files changed (+138 additions, -522 deletions)

View changed files

📝 packages/better-auth/package.json (+102 -408)
📝 packages/better-auth/tsdown.config.ts (+1 -1)
📝 packages/core/package.json (+22 -88)
📝 packages/core/tsdown.config.ts (+1 -1)
📝 packages/expo/package.json (+2 -4)
📝 packages/expo/tsdown.config.ts (+1 -1)
📝 packages/sso/package.json (+2 -4)
📝 packages/sso/tsdown.config.ts (+1 -1)
📝 packages/stripe/package.json (+2 -4)
📝 packages/stripe/tsdown.config.ts (+1 -1)
📝 packages/telemetry/package.json (+2 -8)
📝 packages/telemetry/tsdown.config.ts (+1 -1)

📄 Description

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.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/5703 **Author:** [@himself65](https://github.com/himself65) **Created:** 10/31/2025 **Status:** ✅ Merged **Merged:** 10/31/2025 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `himself65/2025/10/31/esm` --- ### 📝 Commits (1) - [`63bec1c`](https://github.com/better-auth/better-auth/commit/63bec1cd7606f9ba08e8281f73c4cd68ec90a003) feat: esm only ### 📊 Changes **12 files changed** (+138 additions, -522 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/package.json` (+102 -408) 📝 `packages/better-auth/tsdown.config.ts` (+1 -1) 📝 `packages/core/package.json` (+22 -88) 📝 `packages/core/tsdown.config.ts` (+1 -1) 📝 `packages/expo/package.json` (+2 -4) 📝 `packages/expo/tsdown.config.ts` (+1 -1) 📝 `packages/sso/package.json` (+2 -4) 📝 `packages/sso/tsdown.config.ts` (+1 -1) 📝 `packages/stripe/package.json` (+2 -4) 📝 `packages/stripe/tsdown.config.ts` (+1 -1) 📝 `packages/telemetry/package.json` (+2 -8) 📝 `packages/telemetry/tsdown.config.ts` (+1 -1) </details> ### 📄 Description 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. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-17 22:39:06 -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#31767