Skip to content

fix: type annotation issue#5651

Merged
himself65 merged 1 commit intobetter-auth:mainfrom
himself65:himself65/2025/10/28/bundler
Oct 28, 2025
Merged

fix: type annotation issue#5651
himself65 merged 1 commit intobetter-auth:mainfrom
himself65:himself65/2025/10/28/bundler

Conversation

@himself65
Copy link
Copy Markdown
Contributor

@himself65 himself65 commented Oct 28, 2025

Seems like the unbuild issue. It's not happening in 1.4

Fixes: #5637

Summary by cubic

Switch core build to tsdown (rolldown) for faster, simpler builds. Unifies .js outputs and fixes internal imports to play nicely with bundlers.

  • Refactors

    • Replaced unbuild with tsdown; added build and dev (watch) scripts.
    • Updated exports: ESM/CJS now output to dist/*.js; added “better-auth-dev-source” condition for dev.
    • Converted internal imports from “@better-auth/core/*” to local paths across providers and error utils.
    • Updated tsconfig for bundler resolution, incremental declarations, and custom conditions.
  • Dependencies

    • Added tsdown to the workspace; switched core devDependency to tsdown.
    • Removed unbuild from core devDependencies.

@himself65 himself65 requested a review from Bekacru as a code owner October 28, 2025 20:04
@vercel
Copy link
Copy Markdown

vercel bot commented Oct 28, 2025

@himself65 is attempting to deploy a commit to the better-auth Team on Vercel.

A member of the Team first needs to authorize it.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Oct 28, 2025

Open in StackBlitz

better-auth

npm i https://pkg.pr.new/better-auth/better-auth@5651

@better-auth/cli

npm i https://pkg.pr.new/better-auth/better-auth/@better-auth/cli@5651

@better-auth/core

npm i https://pkg.pr.new/better-auth/better-auth/@better-auth/core@5651

@better-auth/expo

npm i https://pkg.pr.new/better-auth/better-auth/@better-auth/expo@5651

@better-auth/sso

npm i https://pkg.pr.new/better-auth/better-auth/@better-auth/sso@5651

@better-auth/stripe

npm i https://pkg.pr.new/better-auth/better-auth/@better-auth/stripe@5651

@better-auth/telemetry

npm i https://pkg.pr.new/better-auth/better-auth/@better-auth/telemetry@5651

commit: 92e2cad

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 40 files

Prompt for AI agents (all 1 issues)

Understand the root cause of the following 1 issues and fix them.


<file name="packages/core/package.json">

<violation number="1" location="packages/core/package.json:6">
Changing the &quot;main&quot; entry to the ESM file means CommonJS consumers that still rely on &quot;main&quot; will now receive an ESM module and throw ERR_REQUIRE_ESM. Please keep &quot;main&quot; pointing to the CommonJS bundle while &quot;module&quot;/exports cover the ESM path.</violation>
</file>

React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.

"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.mjs",
"main": "./dist/index.js",
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot Oct 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing the "main" entry to the ESM file means CommonJS consumers that still rely on "main" will now receive an ESM module and throw ERR_REQUIRE_ESM. Please keep "main" pointing to the CommonJS bundle while "module"/exports cover the ESM path.

Prompt for AI agents
Address the following comment on packages/core/package.json at line 6:

<comment>Changing the &quot;main&quot; entry to the ESM file means CommonJS consumers that still rely on &quot;main&quot; will now receive an ESM module and throw ERR_REQUIRE_ESM. Please keep &quot;main&quot; pointing to the CommonJS bundle while &quot;module&quot;/exports cover the ESM path.</comment>

<file context>
@@ -3,103 +3,113 @@
   &quot;type&quot;: &quot;module&quot;,
-  &quot;main&quot;: &quot;./dist/index.cjs&quot;,
-  &quot;module&quot;: &quot;./dist/index.mjs&quot;,
+  &quot;main&quot;: &quot;./dist/index.js&quot;,
+  &quot;module&quot;: &quot;./dist/index.js&quot;,
   &quot;exports&quot;: {
</file context>
Suggested change
"main": "./dist/index.js",
"main": "./dist/index.cjs",

✅ Addressed in 265bd00

@himself65 himself65 changed the title chore(core): use rolldown fix: type annotation issue Oct 28, 2025
@himself65 himself65 force-pushed the himself65/2025/10/28/bundler branch from b304c85 to d23d77e Compare October 28, 2025 21:09
@himself65 himself65 force-pushed the himself65/2025/10/28/bundler branch from d23d77e to 92e2cad Compare October 28, 2025 21:09
@himself65 himself65 merged commit 3cc966f into better-auth:main Oct 28, 2025
7 of 10 checks passed
@better-auth better-auth locked as resolved and limited conversation to collaborators Apr 1, 2026
@bytaesu bytaesu added the locked Locked conversations after being closed for 7 days label Apr 1, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

locked Locked conversations after being closed for 7 days

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Typescript error in auth export

2 participants