[PR #5995] chore: improve zod imports tree shaking #14617

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

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

State: closed
Merged: Yes


Adjust Zod imports to avoid bundling locale files and reduce the esbuild bundle size by ~260kb.
With the current import { z } from 'zod', the Zod locales end up included in the bundle, which unnecessarily increases the output size.


Summary by cubic

Switched all Zod imports to namespace form to improve tree-shaking and exclude locale files, reducing the esbuild bundle by ~260 KB.

  • Refactors
    • Replaced import { z } from 'zod' with import * as z from 'zod' across core, auth routes, plugins, docs, and scripts; added a Biome rule to enforce this import style.
    • No API or runtime behavior changes.

Written for commit 309204a7a8. Summary will update automatically on new commits.

**Original Pull Request:** https://github.com/better-auth/better-auth/pull/5995 **State:** closed **Merged:** Yes --- Adjust Zod imports to avoid bundling locale files and reduce the esbuild bundle size by ~260kb. With the current import { z } from 'zod', the Zod locales end up included in the bundle, which unnecessarily increases the output size. <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Switched all Zod imports to namespace form to improve tree-shaking and exclude locale files, reducing the esbuild bundle by ~260 KB. - **Refactors** - Replaced `import { z } from 'zod'` with `import * as z from 'zod'` across core, auth routes, plugins, docs, and scripts; added a Biome rule to enforce this import style. - No API or runtime behavior changes. <sup>Written for commit 309204a7a8966ad0e6d0827268cab5f91649243a. 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:32:37 -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#14617