nuxt-swiper icon indicating copy to clipboard operation
nuxt-swiper copied to clipboard

Support with Storybook

Open piercemorris opened this issue 1 year ago • 1 comments

I'm trying to get the components provided by nuxt-swiper working in a Storybook context. However, there is nothing exported from the package that allows for the components to be resolved. This could be down to the Storybook framework I am using (@storybook/vue3-vite), but we have solved this by manually resolving the components ourselves. This isn't possible with the current module as those components are not exported.

If components were exported it would be possible to do something like

export const SwiperResolver: ComponentResolver = name => {
  if (['Swiper', 'SwiperSlide'].includes(name)) {
    return { as: name, from: 'nuxt-swiper', name }
  }
}

Has anyone else come across this or has a workaround? I'm happy to provide examples to give more context around this issue if needed.

Thanks in advance :)

piercemorris avatar Oct 11 '23 10:10 piercemorris

Question. Are you using nuxt? The reason I ask is this module just makes it to where it auto imports using nuxt's auto-imports. if storybook can't support auto import then I don't see this working.

Also if you just want to import them directly from import {Swiper, SwiperSlide } from 'swiper/vue'.

cpreston321 avatar Dec 13 '23 02:12 cpreston321