[GH-ISSUE #8271] bundle size has increased in v1.5 #28363

Closed
opened 2026-04-17 19:47:35 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @sacrosanctic on GitHub (Mar 2, 2026).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/8271

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

The bundle size has increased even though the blog states that this reduces bundle size.

Current vs. Expected behavior

.

What version of Better Auth are you using?

1.5.0

System info

.

Which area(s) are affected? (Select all that apply)

Package

Auth config (if applicable)


Additional context

No response

Originally created by @sacrosanctic on GitHub (Mar 2, 2026). Original GitHub issue: https://github.com/better-auth/better-auth/issues/8271 ### Is this suited for github? - [x] Yes, this is suited for github ### To Reproduce The [bundle size has increased](https://npmx.dev/package/better-auth/v/1.5.0) even though the blog states that this [reduces bundle size](https://better-auth.com/blog/1-5#adapter-extraction). ### Current vs. Expected behavior . ### What version of Better Auth are you using? 1.5.0 ### System info ```bash . ``` ### Which area(s) are affected? (Select all that apply) Package ### Auth config (if applicable) ```typescript ``` ### Additional context _No response_
GiteaMirror added the locked label 2026-04-17 19:47:35 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Mar 2, 2026):

Hi @sacrosanctic! I'm Dosu and I’m helping the better-auth team.

The bundle size increase you're seeing is a known issue — it's primarily caused by Zod locales being bundled into the client, which maintainers have acknowledged as a bug (validation shouldn't be on the client side).

The adapter extraction feature does reduce bundle size, but requires active migration to see the benefits. Simply upgrading to v1.5.0 without changing your imports won't reduce bundle size because the main package re-exports all adapters for backward compatibility.

To realize bundle size improvements, you'd need to:

  1. Use the separate adapter packages (e.g., @better-auth/drizzle-adapter)
  2. Import from better-auth/client/plugins instead of better-auth/plugins
  3. Optionally import from better-auth/minimal
  4. If using Vite, add optimizeDeps: { exclude: ['better-auth'] } to your config

The existing issue #6213 tracks the Zod locale bundling problem specifically.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

Chat with Dosu Open in Cursor Join Discord Share on X

<!-- gh-comment-id:3981588967 --> @dosubot[bot] commented on GitHub (Mar 2, 2026): <!-- Greeting --> Hi @sacrosanctic! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the better-auth team. <!-- Answer --> The bundle size increase you're seeing is a [known issue](https://github.com/better-auth/better-auth/issues/6213) — it's primarily caused by **Zod locales being bundled** into the client, which maintainers have acknowledged as a bug (validation shouldn't be on the client side). The adapter extraction feature does reduce bundle size, but **requires active migration** to see the benefits. Simply upgrading to v1.5.0 without changing your imports won't reduce bundle size because the main package re-exports all adapters for backward compatibility. To realize bundle size improvements, you'd need to: 1. Use the separate adapter packages (e.g., `@better-auth/drizzle-adapter`) 2. Import from `better-auth/client/plugins` instead of `better-auth/plugins` 3. Optionally import from `better-auth/minimal` 4. If using Vite, add `optimizeDeps: { exclude: ['better-auth'] }` to your config The existing issue #6213 tracks the Zod locale bundling problem specifically. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/3dd2dcb8-4201-456e-b8d7-c94bb9b26c00?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/3dd2dcb8-4201-456e-b8d7-c94bb9b26c00?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/3dd2dcb8-4201-456e-b8d7-c94bb9b26c00?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/3dd2dcb8-4201-456e-b8d7-c94bb9b26c00?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/3dd2dcb8-4201-456e-b8d7-c94bb9b26c00?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/3dd2dcb8-4201-456e-b8d7-c94bb9b26c00?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/3dd2dcb8-4201-456e-b8d7-c94bb9b26c00?feedback_type=other)</sup> [![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/cdda13d9-dd27-4d31-b09a-5d8bec92de21/ask?utm_source=github)&nbsp;[![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=The%20bundle%20size%20increase%20you%27re%20seeing%20is%20a%20%5Bknown%20issue%5D%28https%3A//github.com/better-auth/better-auth/issues/6213%29%20%E2%80%94%20it%27s%20primarily%20caused%20by%20%2A%2AZod%20locales%20being%20bundled%2A%2A%20into%20the%20client%2C%20which%20maintainers%20have%20acknowledged%20as%20a%20bug%20%28validation%20shouldn%27t%20be%20on%20the%20client%20side%29.%0A%0AThe%20adapter%20extraction%20feature%20does%20reduce%20bundle%20size%2C%20but%20%2A%2Arequires%20active%20migration%2A%2A%20to%20see%20the%20benefits.%20Simply%20upgrading%20to%20v1.5.0%20without%20changing%20your%20imports%20won%27t%20reduce%20bundle%20size%20because%20the%20main%20package%20re-exports%20all%20adapters%20for%20backward%20compatibility.%0A%0ATo%20realize%20bundle%20size%20improvements%2C%20you%27d%20need%20to%3A%0A1.%20Use%20the%20separate%20adapter%20packages%20%28e.g.%2C%20%60%40better-auth/drizzle-adapter%60%29%0A2.%20Import%20from%20%60better-auth/client/plugins%60%20instead%20of%20%60better-auth/plugins%60%0A3.%20Optionally%20import%20from%20%60better-auth/minimal%60%0A4.%20If%20using%20Vite%2C%20add%20%60optimizeDeps%3A%20%7B%20exclude%3A%20%5B%27better-auth%27%5D%20%7D%60%20to%20your%20config%0A%0AThe%20existing%20issue%20%236213%20tracks%20the%20Zod%20locale%20bundling%20problem%20specifically.)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/better-auth/better-auth/issues/8271)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#28363