Giter Club home page Giter Club logo

Comments (7)

decs avatar decs commented on June 1, 2024 1

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.

sillvva avatar sillvva commented on June 1, 2024 1

Perfect!

from typeschema.

sillvva avatar sillvva commented on June 1, 2024

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.

decs avatar decs commented on June 1, 2024

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.

decs avatar decs commented on June 1, 2024

It seems to be related to Vite's bundling vitejs/vite#6007

from typeschema.

sillvva avatar sillvva commented on June 1, 2024

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.

sillvva avatar sillvva commented on June 1, 2024

I managed to get it to build with external: ["@decs/typeschema", "fp-ts", "fp-ts/Either"], but then I get this when running it:

CleanShot 2023-08-11 at 09 03 14@2x

Still can't get it working in dev, though.

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.