-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Description
I tried migrating some validation code I have form Zod to Zod Mini in order to reduce my project's final bundle size.
I did get a 10KB drop when doing so but the bundle size is still large with a majority of the size coming from Zod's locales.
Below is the esbuild analysis:
I am using Zod v4.2.1 with the following (among other) esbuild compiler options:
{
bundle: true,
format: "cjs",
target: "es2018",
treeShaking: true,
}
and the following tsconfig compiler options:
{
"module": "nodenext",
"target": "ES2018",
"moduleResolution": "nodenext",
}
I'm using wildcard imports (as suggested in the documentation and other reported issues) and I even tried the following variants to no effect:
import * as zod from "zod/mini";
import * as zod from "zod/v4-mini";
import * as zod from "zod/v4/mini";Are there any other options I should be setting or actions I should take to get the locales removed from the bundle?
Pilaton, GRA0007 and VitaliyPotapovcoderabbitai and CHC383
Metadata
Metadata
Assignees
Labels
No labels