Wondering about bundle size #1016
Answered
by
fabian-hiller
TomFreudenberg
asked this question in
Q&A
-
Hi, after listening to your talk videos @fabian-hiller I wonder about your "QuickStart" examples. Always you show code like:
Isn't that against what you are talking in your talk - "hold things small" and don't blurr apps? Isn't there a difference in bundle size when using:
Is this just to make examples easy or is this your best case suggestion? Thanks for some feedback |
Beta Was this translation helpful? Give feedback.
Answered by
fabian-hiller
Jan 15, 2025
Replies: 1 comment 2 replies
-
Hi Tom, there is not difference in bundle size. import * as v from 'valibot';
v.string(); Produces the exact same output as: import { string } from 'valibot';
string(); Feel free to copy both snippets into bundlejs to verify it: https://bundlejs.com/ |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A wildcard import is treated as a static import. Therefore, it is fully tree-shakable. I usually recommend wildcard imports because they can provide a better DX through better auto-completion and suggestion support in various editors.