I’m using zod version 4 "zod": "4.0"
in my Shopify POS UI Extension but when the Shopify CLI bundles it for distribution it breaks safeParse
I made a minimal example outside of Shopify CLI and used rollup to bundle zod 4 and it worked. So I know it’s something about how Shopify CLI is bundling.
You can easily reproduce by running this line of code anywhere during load
const myConst = {
input: z.object({ orderName: z.string() }),
output: z.object({ orderId: z.string() }),
};
const result = myConst.input.safeParse(data);
The error message you will receive is:
Error in input TypeError: Cannot read properties of undefined (reading 'issues')