-
-
Notifications
You must be signed in to change notification settings - Fork 57
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
All validation libraries from optional dependencies are installed in dev environment #351
Comments
I've added a reproduction with screenshot - https://github.com/vladshcherbin/svelte-superforms. From screenshot it's visible From superforms & valibot dependency commit it's visible how many unused packages are installed which is also not desirable for the reasons above. I'd be happy to help solve but have no idea except splitting adapters into different packages and install only needed e.g. yarn add sveltekit-superforms sveltekit-superforms-adapters/valibot valibot |
What's installed during development is not an issue, I'm concerned with the final bundle size. You can even look through the non-minified output to see that Zod is never referenced anywhere. |
About the circular dependency, it doesn't happen with pnpm, so maybe it's a yarn issue. |
Well, that's the best reproduction I can give. I do believe both issues should be solved and only required libraries be installed but I respect your opinion, direction and ideas. Sorry for opening so many issues and thanks for the library, everything else seems to be working and simplifying forms is a huge relief 😇 Hopefully this ones can be resolved some day 🙌 |
If it helps at all, I came across this issue while investigating this warning:
I've been playing with superforms (via formsnap). It's great! But I was puzzled where @vinejs was coming from, having not installed it. From: I agree that (in my case) @vinejs won't be in the production bundle ... however its presence does seemingly result in that Vite warning while bundling it. Vine appears to be form validation focused on Node apps and so while they might change it at their end, not including it as a peer dependency would also avoid that warning. I would assume people would install their choice of validation library separately. I do agree it's an enhancement since a warning isn't an error. |
Description
Found in #350
Currently all validation libraries are installed even when they are not used (all optional dependencies).
This is not good for a lot of reasons - wasted space, traffic, package stats update, etc.
From referenced issue it's also visible that some bundlers (
vite
in my case) are trying to process/include this dependencies in the bundle which is also not desired.You can see a massive library size increase: https://packagephobia.com/result?p=sveltekit-superforms@2.3.0
I've tried different combinations of commands with no luck to install only what I need:
A solution should be found on how to get only used packages 🤔
The text was updated successfully, but these errors were encountered: