[PR #5230] [CLOSED] chore: use bunchee to remove duplicate generated types #5869

Closed
opened 2026-03-13 12:39:39 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/5230
Author: @himself65
Created: 10/11/2025
Status: Closed

Base: canaryHead: himself65/2025/10/10/bundler


📝 Commits (4)

  • 5c8ef16 chore: use bunchee
  • f6e0c2c chore: use bunchee
  • e64ff39 chore: fix build
  • 96dc3d2 chore: add @better-auth/core to externals in build config

📊 Changes

51 files changed (+741 additions, -376 deletions)

View changed files

e2e/smoke/test/fixtures/tsconfig-verbatim-module-syntax-node10/package.json (+13 -0)
e2e/smoke/test/fixtures/tsconfig-verbatim-module-syntax-node10/src/index.ts (+8 -0)
e2e/smoke/test/fixtures/tsconfig-verbatim-module-syntax-node10/tsconfig.json (+14 -0)
e2e/smoke/test/typecheck.ts (+13 -0)
📝 packages/better-auth/build.config.ts (+1 -0)
packages/cli/build.config.ts (+0 -7)
📝 packages/cli/package.json (+10 -10)
packages/core/build.config.ts (+0 -23)
📝 packages/core/package.json (+4 -4)
📝 packages/core/src/error/codes.ts (+1 -1)
📝 packages/core/src/oauth2/validate-authorization-code.ts (+1 -1)
📝 packages/core/src/social-providers/apple.ts (+2 -2)
📝 packages/core/src/social-providers/atlassian.ts (+4 -4)
📝 packages/core/src/social-providers/cognito.ts (+4 -4)
📝 packages/core/src/social-providers/discord.ts (+2 -2)
📝 packages/core/src/social-providers/dropbox.ts (+2 -2)
📝 packages/core/src/social-providers/facebook.ts (+3 -3)
📝 packages/core/src/social-providers/figma.ts (+4 -4)
📝 packages/core/src/social-providers/github.ts (+2 -2)
📝 packages/core/src/social-providers/gitlab.ts (+2 -2)

...and 31 more files

📄 Description

The original issue should be unbuild; they didn't generate the type into one file for the shared module. So each file entry point would have a different BetterAuthOptions type

Fixes: https://github.com/better-auth/better-auth/issues/2471
Fixes: https://github.com/better-auth/better-auth/issues/5122
Fixes: https://github.com/better-auth/better-auth/issues/5119
Fixes: https://github.com/better-auth/better-auth/issues/1974
Fixes: https://github.com/better-auth/better-auth/issues/4654


Summary by cubic

Switch TypeScript moduleResolution to node16 and align our build to ESM/CJS with tsdown. This fixes subpath resolution and bundling issues across core and Expo, and adds a Hono e2e fixture to validate the setup.

  • Refactors

    • Set module/moduleResolution to node16 in core; update internal imports to ESM (.js) and stable subpaths.
    • Replace unbuild with tsdown; emit ESM (.js), CJS (.cjs), and dts in core and Expo.
    • Move Expo to use @better-auth/core middleware/types; update exports to .js and add react-native as a peer.
  • Migration

    • Set your tsconfig moduleResolution to node16 (NodeNext module recommended).
    • No consumer code changes expected; keep using better-auth and @better-auth/expo. If you import core subpaths, use @better-auth/core/...

🔄 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/5230 **Author:** [@himself65](https://github.com/himself65) **Created:** 10/11/2025 **Status:** ❌ Closed **Base:** `canary` ← **Head:** `himself65/2025/10/10/bundler` --- ### 📝 Commits (4) - [`5c8ef16`](https://github.com/better-auth/better-auth/commit/5c8ef164a1e49874280e5f83d9497ca260e1ca45) chore: use bunchee - [`f6e0c2c`](https://github.com/better-auth/better-auth/commit/f6e0c2cfc45255a7d61997eeecc21f00d109409e) chore: use bunchee - [`e64ff39`](https://github.com/better-auth/better-auth/commit/e64ff39da037c08f6dcdeb5fb3e65a11323b7345) chore: fix build - [`96dc3d2`](https://github.com/better-auth/better-auth/commit/96dc3d2f02541bc7b55efc6f2c53aa363bfb1c28) chore: add @better-auth/core to externals in build config ### 📊 Changes **51 files changed** (+741 additions, -376 deletions) <details> <summary>View changed files</summary> ➕ `e2e/smoke/test/fixtures/tsconfig-verbatim-module-syntax-node10/package.json` (+13 -0) ➕ `e2e/smoke/test/fixtures/tsconfig-verbatim-module-syntax-node10/src/index.ts` (+8 -0) ➕ `e2e/smoke/test/fixtures/tsconfig-verbatim-module-syntax-node10/tsconfig.json` (+14 -0) ➕ `e2e/smoke/test/typecheck.ts` (+13 -0) 📝 `packages/better-auth/build.config.ts` (+1 -0) ➖ `packages/cli/build.config.ts` (+0 -7) 📝 `packages/cli/package.json` (+10 -10) ➖ `packages/core/build.config.ts` (+0 -23) 📝 `packages/core/package.json` (+4 -4) 📝 `packages/core/src/error/codes.ts` (+1 -1) 📝 `packages/core/src/oauth2/validate-authorization-code.ts` (+1 -1) 📝 `packages/core/src/social-providers/apple.ts` (+2 -2) 📝 `packages/core/src/social-providers/atlassian.ts` (+4 -4) 📝 `packages/core/src/social-providers/cognito.ts` (+4 -4) 📝 `packages/core/src/social-providers/discord.ts` (+2 -2) 📝 `packages/core/src/social-providers/dropbox.ts` (+2 -2) 📝 `packages/core/src/social-providers/facebook.ts` (+3 -3) 📝 `packages/core/src/social-providers/figma.ts` (+4 -4) 📝 `packages/core/src/social-providers/github.ts` (+2 -2) 📝 `packages/core/src/social-providers/gitlab.ts` (+2 -2) _...and 31 more files_ </details> ### 📄 Description The original issue should be `unbuild`; they didn't generate the type into one file for the shared module. So each file entry point would have a different `BetterAuthOptions` type Fixes: https://github.com/better-auth/better-auth/issues/2471 Fixes: https://github.com/better-auth/better-auth/issues/5122 Fixes: https://github.com/better-auth/better-auth/issues/5119 Fixes: https://github.com/better-auth/better-auth/issues/1974 Fixes: https://github.com/better-auth/better-auth/issues/4654 <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Switch TypeScript moduleResolution to node16 and align our build to ESM/CJS with tsdown. This fixes subpath resolution and bundling issues across core and Expo, and adds a Hono e2e fixture to validate the setup. - **Refactors** - Set module/moduleResolution to node16 in core; update internal imports to ESM (.js) and stable subpaths. - Replace unbuild with tsdown; emit ESM (.js), CJS (.cjs), and dts in core and Expo. - Move Expo to use @better-auth/core middleware/types; update exports to .js and add react-native as a peer. - **Migration** - Set your tsconfig moduleResolution to node16 (NodeNext module recommended). - No consumer code changes expected; keep using better-auth and @better-auth/expo. If you import core subpaths, use @better-auth/core/... <!-- 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-03-13 12:39:39 -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#5869