sdk-for-svelte
sdk-for-svelte copied to clipboard
๐ Bug Report: Not working with SvelteKit (SSR)
๐ 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:

๐ฒ 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?
- [X] I have read the Code of Conduct
Same issues for me..
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