Comments (2)
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.
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)
- TypeBox Optimization HOT 2
- Add support for valibot HOT 2
- Error: Missing adapters for schema: [object Object] HOT 7
- Yet another library - valita HOT 3
- We will change the `safeParseAsync` API of Valibot HOT 4
- Typeschema is no more extensible HOT 1
- Yet another library - suretype HOT 1
- Document which versions are supported HOT 1
- "Module not found" errors on next.js HOT 3
- Can ajv-ts be used for inferring the schema type? HOT 1
- Support for class validator HOT 5
- Add JSON Schema export to the API? HOT 2
- TypeSchema breaks Next.js Turbopack dev server and edge deployment HOT 4
- Support synchronous validate
- Proposal: common set schema api HOT 3
- export of type Schema is missing in @typeschema/main HOT 1
- Support for Vinejs HOT 1
- Action error: Cannot find package '@typeschema/zod' imported from /var/task/.next/server/chunks/762.js in Nextjs production
- Make `validate` function synchronous if possible
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from typeschema.