Giter Club home page Giter Club logo

Comments (6)

gregmsanderson avatar gregmsanderson commented on May 26, 2024 2

If it helps at all, I came across this issue while investigating this warning:

vite v5.1.3 building for production...
[plugin:vite:resolve] Module "node:dns/promises" has been externalized for browser compatibility, imported by "/node_modules/@vinejs/vine/build/chunk-TVEIURSI.js". See https://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.

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: npm ls --all I noticed a peer dependency.

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.

from sveltekit-superforms.

ciscoheat avatar ciscoheat commented on May 26, 2024

This is not accurate, the packages are only installed in a dev environment. Vite/Rollup will only bundle what's referenced in the project. For example, when I build with Valibot:

2024-02-19 13_19_07-+page svelte - sf2-bundle - Visual Studio Code

from sveltekit-superforms.

vladshcherbin avatar vladshcherbin commented on May 26, 2024

I've added a reproduction with screenshot - https://github.com/vladshcherbin/svelte-superforms.

From screenshot it's visible vite is at least processing zod-to-json-schema which is not used anywhere in the app.

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

from sveltekit-superforms.

ciscoheat avatar ciscoheat commented on May 26, 2024

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.

from sveltekit-superforms.

ciscoheat avatar ciscoheat commented on May 26, 2024

About the circular dependency, it doesn't happen with pnpm, so maybe it's a yarn issue.

from sveltekit-superforms.

vladshcherbin avatar vladshcherbin commented on May 26, 2024

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 🙌

from sveltekit-superforms.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.