Open dimdenGD opened 1 year ago
Same issue in Astro
Getting th exact same error
Same
I had a slightly different error but also caused by a new sveltekit version, so maybe it will help you too: I used vite-plugin-iso-import as per the svelte docs for client-side only packages (last snippet).
It looks like this:
<script>
import Carousel from 'svelte-carousel?client';
// ...
</script>
You can also remove the vite exceptions in your vite.config.js
so it looks like this:
import { sveltekit } from '@sveltejs/kit/vite';
import { isoImport } from 'vite-plugin-iso-import'
const config = {
plugins: [isoImport(), sveltekit()],
};
export default config;
Tested in sveltekit v1.13.0.
same issue
With the browser module you can run code client-side only.
<script>
import { browser } from '$app/environment';
import Carousel from 'svelte-carousel';
export let testimonials;
</script>
{#if browser}
<Carousel>
{#each testimonials as testimonial}
...
{/each}
</Carousel>
{/if}
Works for me in SvelteKit v1.20.4
same issue on svelte 4
I get error in the title when trying to use it like this in SvelteKit 1.5.0:
using code:
Versions: "@sveltejs/adapter-auto": "^2.0.0", "@sveltejs/kit": "^1.5.0", "svelte": "^3.54.0", "svelte-carousel": "^1.0.23", "vite": "^4.0.0"