vadimkorr / svelte-carousel

The awesome carousel component for Svelte 3 :arrow_left: :art: :arrow_right:
https://vadimkorr.github.io/svelte-carousel
Apache License 2.0
285 stars 63 forks source link

Doesn't work in new sveltekit #122

Closed JeffWScott closed 1 year ago

JeffWScott commented 1 year ago
image

Followed instructions for svelte kit install. Which are also out of date because kit.vite is no longer a config option.

Dhirajraje commented 1 year ago

Same problem. Any luck?

oetiker commented 1 year ago

what works is this:

  let Carousel: ConstructorOfATypedSvelteComponent; // for saving Carousel component class
  onMount(async () => {
    const module = await import('svelte-carousel');
    Carousel = module.default;
  });

and then later

    {#if browser}
    <svelte:component
      this={Carousel}
      autoplay
      autoplayDuration={4000}
      duration={500}
      dots={true}
      arrows={false}
    >
      ...
    </svelte:component>
    {/if}

but obviously it would be great if the component were working without tricks

michapixel commented 1 year ago

update to new sveltekit (1.0.0) and don't forget to update vite too (v.4.0.0)

should be solved then (although there's still awarinng about a missing "type:module" in package.json of this component. :)

aunumever commented 1 year ago

The error for the missing type: module svelte-carousel doesn't appear to be written in CJS, but also doesn't appear to be a valid ES module (i.e. it doesn't have "type": "module" or an .mjs extension for the entry point). Please contact the package author to fix.

Metro13 commented 1 year ago

I can work on this issue

HoseokYoo commented 1 year ago

what works is this:

  let Carousel: ConstructorOfATypedSvelteComponent; // for saving Carousel component class
  onMount(async () => {
    const module = await import('svelte-carousel');
    Carousel = module.default;
  });

and then later

  {#if browser}
  <svelte:component
    this={Carousel}
    autoplay
    autoplayDuration={4000}
    duration={500}
    dots={true}
    arrows={false}
  >
    ...
  </svelte:component>
  {/if}

but obviously it would be great if the component were working without tricks

it's works thank you

vadimkorr commented 1 year ago

Should be fixed in https://github.com/vadimkorr/svelte-carousel/pull/126