Skip to content

Zod imports fail to treeshake on webpack #394

@GRA0007

Description

@GRA0007

Some bundlers have stricter treeshaking requirements than others, and Webpack (and Turbopack) used by Next.js don't seem to be able to treeshake Zod imports unless they're formatted like import * as z from 'zod'.

See this comment for more details: colinhacks/zod#4433 (comment)

Using a bundle analyser, I can see that Next.js projects using t3-env also include all of the zod locales because the imports are currently formatted like import { z } from 'zod'. I propose updating these imports to allow more bundlers to treeshake correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions