Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: tree-shakable zod #423

Merged
merged 1 commit into from
Jan 13, 2025
Merged

feat: tree-shakable zod #423

merged 1 commit into from
Jan 13, 2025

Conversation

peterpeterparker
Copy link
Member

Motivation

Make Zod tree-shakable.

Reference

colinhacks/zod#2596

Changes

Before:

import { z } from 'zod';

After:

import * as z from 'zod';

Copy link
Contributor

@AntonioVentilii AntonioVentilii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM tks

@peterpeterparker peterpeterparker merged commit 9ca8768 into main Jan 13, 2025
11 checks passed
@peterpeterparker peterpeterparker deleted the feat/tree-shakable-zod branch January 13, 2025 07:55
peterpeterparker added a commit to dfinity/oisy-wallet that referenced this pull request Jan 13, 2025
# Motivation

Even though we do not really win much (3kb for the worker), for the
state of the art, we can make Zod tree-shakable.

# References

- colinhacks/zod#2596
- dfinity/oisy-wallet-signer#423

# Changes

Before:

```
import { z } from 'zod';
```

After:

```
import * as z from 'zod';
```

# Screenshots

Worker bundle as example.

Before:

<img width="1536" alt="Capture d’écran 2025-01-13 à 10 24 25"
src="https://github.com/user-attachments/assets/11d75e33-b802-4e33-a70f-7594b11c74ed"
/>

After:

<img width="1536" alt="Capture d’écran 2025-01-13 à 10 25 33"
src="https://github.com/user-attachments/assets/38930640-f738-43c3-8828-c8287efe3c86"
/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants