Comments (7)
Solved! I wrapped the handling logic into a Vite plugin in v0.9.1
, which can be easily plugged in your vite.config.ts
:
import { typeschemaPlugin } from "@decs/typeschema/vite";
export default defineConfig({
plugins: [
typeschemaPlugin(), // add this plugin
],
});
If you're still seeing an error, feel free to open another issue and I can take a look. Thanks for the feedback!
from typeschema.
Perfect!
from typeschema.
Yeah, so it looks like something in SvelteKit or typeschema is dropping all the adapters before getting to the client. It works on the server. Not going to work for client-side form validating, though.
// SchemaForm.svelte
import { adapters } from "@decs/typeschema/dist/registry";
console.log(adapters.length); // client: 0, server: 13
I've dropped @decs/typeschema from the project for now.
from typeschema.
hey, @sillvva! I refactored the adapter registry with the new version (v0.8.2). I'm not very familiar with Svelte, but I tried it and it seems it's now working. though I apparently needed to add some of the optional peer dependencies to build.rollupOptions.external
to allow for building the app. Could you help further test it? Thanks!!
from typeschema.
It seems to be related to Vite's bundling vitejs/vite#6007
from typeschema.
Yeah, I get this error now. This error is during dev, not build, though.
[vite] error while updating dependencies:
Error: Build failed with 2 errors:
node_modules/.pnpm/@[email protected][email protected]/node_modules/@decs/typeschema/dist/io-ts-BRWJAQV3.mjs:2:24: ERROR: Could not resolve "fp-ts/Either"
node_modules/.pnpm/@[email protected][email protected]/node_modules/@decs/typeschema/dist/typebox-WF7VWWUM.mjs:2:29: ERROR: Could not resolve "@sinclair/typebox/compiler"
at failureErrorWithLog (/Users/sillvva/Projects/ddal-svelte/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:1639:15)
at /Users/sillvva/Projects/ddal-svelte/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:1051:25
at /Users/sillvva/Projects/ddal-svelte/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:1515:9
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Could you explain what I need to add to the vite config?
from typeschema.
I managed to get it to build with external: ["@decs/typeschema", "fp-ts", "fp-ts/Either"]
, but then I get this when running it:
Still can't get it working in dev, though.
from typeschema.
Related Issues (20)
- You might be interrested to take a look at typematic HOT 1
- TypeBox Optimization HOT 2
- Add support for valibot HOT 2
- 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
- Schema is wrongly typed for schemas having output!=input HOT 2
- Assert only throws the first error HOT 1
- Beyond validation - introspecting the schema HOT 13
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.