Skip to content
This repository was archived by the owner on Jul 8, 2025. It is now read-only.
This repository was archived by the owner on Jul 8, 2025. It is now read-only.

Gatsby Build - SSR failed #732

@lorraineS

Description

@lorraineS

Hello,

I've been trying to use react-carousel in my project, while it works in development, it doesn't when I try to build.

I have read all the posts that deal with this problem and I manage to partially solve it EXCEPT when I have to use slidesToShowPlugin and autoplayPlugin.

Here is my import which works locally :
import Carousel, { slidesToShowPlugin, autoplayPlugin } from '@brainhubeu/react-carousel';

I changed it to this one:
const Carousel = loadable(() => import('@brainhubeu/react-carousel'))

show me errors :

45:26  error  'autoplayPlugin' is not defined      no-undef
56:29  error  'slidesToShowPlugin' is not defined  no-undef

My Carousel component refers to several plugins:

<Carousel
            offset={30}
            minDraggableOffset={0}
            keepDirectionWhenDragging={true}
            plugins={[
              {
                resolve: autoplayPlugin,
                options: {
                  interval: 4000,
                }
              },
            ]}
            animationSpeed={1000}
            breakpoints={{
              900: {
                plugins: [
                 {
                   resolve: slidesToShowPlugin,
                   options: {
                    numberOfSlides: 1
                   }
                 },
               ]
              }
            }}
          >
            {props.list.map(item) => {
              return (
                <CardV3
                  title={item.title}
                />
              )
            })}
</Carousel>

I specify that I use Gatsby and not Next.js. So I used the "loadable" library which is mentioned by another user (last message here : #287) and which works well, except when it is also necessary to import plugins from Carousel.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions