-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Description
When @b9g/zen is bundled, it pulls in ~598KB of Zod locale files (50+ languages) that are never used.
@b9g/zen 598.4 KB 79 14.4%
The 79 files are almost entirely Zod locales:
// node_modules/@b9g/zen/node_modules/zod/v4/locales/ar.js
// node_modules/@b9g/zen/node_modules/zod/v4/locales/az.js
// node_modules/@b9g/zen/node_modules/zod/v4/locales/be.js
// ... (50+ locale files)
Root Cause
This is a known Zod issue where export * as locales from "../locales/index.js" prevents tree-shaking:
The issue affects esbuild, webpack, and turbopack. There's currently no workaround except using Rollup.
Suggested Workarounds
Until Zod fixes this upstream:
- Wait for Zod to fix the tree-shaking issue
- Consider using
zod/miniif it has better tree-shaking characteristics - Consider a lighter validation library for simple use cases
Impact
For applications that don't use @b9g/zen database features, this adds ~600KB of unused code to the bundle.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels