sdk-for-svelte icon indicating copy to clipboard operation
sdk-for-svelte copied to clipboard

๐Ÿ› Bug Report: Not working with SvelteKit (SSR)

Open MarvinJWendt opened this issue 3 years ago โ€ข 2 comments

๐Ÿ‘Ÿ Reproduction steps

Use module in SSR context. My code:

<SDK>
                <Create let:actions on:success on:failure>
                    <input bind:value={name} class="input" type="text" placeholder="username"/>
                    <input bind:value={email} class="input" type="email" placeholder="email"/>
                    <input bind:value={password} class="input" type="password" placeholder="password"/>
                    <Button class="button" on:click={actions.create(email, password, name)} type="submit"
                            label="Register"/>
                </Create>
</SDK>

SDK contains the default init from the README.

๐Ÿ‘ Expected behavior

No errors

๐Ÿ‘Ž Actual Behavior

Errors:

image

๐ŸŽฒ Appwrite version

Version 0.10.x

๐Ÿ’ป Operating system

Windows

๐Ÿงฑ Your Environment

I'm using SvelteKit with SSR.

๐Ÿ‘€ Have you spent some time to check if this issue has been raised before?

  • [X] I checked and didn't find similar issue

๐Ÿข Have you read the Code of Conduct?

MarvinJWendt avatar Feb 23 '22 09:02 MarvinJWendt

Same issues for me..

MoritzHeld avatar Feb 24 '22 10:02 MoritzHeld

Try adding 'appwrite' to vite's dependencies to be prebundled.

import adapter from '@sveltejs/adapter-auto';

/** @type {import('@sveltejs/kit').Config} */
const config = {
  kit: {
    adapter: adapter(),
    vite: {
      optimizeDeps: {
        include: ['appwrite'],  // <-- here
      },
    }
  }
};

export default config;

More on optimizeDeps here: https://vitejs.dev/config/#optimizedeps-include

michaelmob avatar Mar 02 '22 03:03 michaelmob