Giter Club home page Giter Club logo

Comments (2)

decs avatar decs commented on June 6, 2024 1

hey, @TheEdoRan! thanks for investigating and reporting! I spent some time looking on this and learned that the Edge runtime has a limited API, which doesn't support dynamic imports (await import(...)).

The thing is that typeschema heavily relies on those to allow for optional peer dependencies. But while they're what make typeschema technically possible, bundler support can be a bit spotty, causing issues like this.

The best path forward long term would be to move away of dynamic imports. Though I haven't yet found a way to do it without setbacks to the developer experience and/or treeshaking. I'll leave this issue open for now and focus on an alternative for dynamic imports.

from typeschema.

TheEdoRan avatar TheEdoRan commented on June 6, 2024 1

Though I haven't yet found a way to do it without setbacks to the developer experience and/or treeshaking.

Yeah, moving away from dynamic imports would probably result in a worse DX. As I said in the OP, though, Vercel is apparently abandoning edge runtime in favor of PPR (Partial Prerendering), which I think is much better; edge runtime has always been very limited and unpleasant to use, but that's just my take. Now, I don't know if this will ever happen, but I think they understood that it isn't really the best rendering/compute model going forward.

What I'll do with next-safe-action (at least for now) is export a copy of the "safe action client" instance from /zod path, that will just support Zod as validation library and use its schema parse function, then explain why and when this is needed in a troubleshooting section on the docs website. All this to say that in my opinion it's probably fine to keep dynamic imports for the better DX, and if some users experience problems related to TypeSchema, they can switch the import from / to /zod to use the lib without issues, with the only drawback of limited validation library support. I think it's a good compromise.

Please let me know your thoughts about this, and once again, thanks for your work with this amazing library @decs!

from typeschema.

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.